Skip to content

Commit

Permalink
Do not require importing global styles, close #197
Browse files Browse the repository at this point in the history
  • Loading branch information
MurhafSousli committed Oct 3, 2018
1 parent 06b3601 commit ea041a5
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 261 deletions.
1 change: 1 addition & 0 deletions projects/core/src/lib/components/gallery.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { IframeItem, ImageItem, VideoItem, YoutubeItem } from './templates';
@Component({
selector: 'gallery',
changeDetection: ChangeDetectionStrategy.OnPush,
styleUrls: ['../styles/gallery.scss'],
template: `
<gallery-core [state]="galleryRef.state$ | async"
[config]="galleryRef.config$ | async"
Expand Down
105 changes: 56 additions & 49 deletions projects/core/src/lib/styles/core.scss
Original file line number Diff line number Diff line change
@@ -1,60 +1,67 @@
gallery {
position: relative;
z-index: 1;
overflow: hidden;
display: block;
height: 500px;
background-color: black;
* {
box-sizing: border-box;
::ng-deep {
gallery {
position: relative;
z-index: 1;
overflow: hidden;
display: block;
height: 500px;
background-color: black;
* {
box-sizing: border-box;
}
}
}

gallery, gallery-core {
position: relative;
overflow: hidden;
}

gallery-core, .g-box, .g-slider {
display: flex;
height: 100%;
width: 100%;
}
gallery,
gallery-core {
position: relative;
overflow: hidden;
}

gallery[fluid] {
transform: translateX(-50vw);
width: 100vw;
left: 50%;
&[fluid='false'] {
transform: none;
width: initial;
left: initial;
gallery-core,
.g-box,
.g-slider {
display: flex;
height: 100%;
width: 100%;
}
}

.g-no-transition {
transition: unset !important;
}
gallery[fluid] {
transform: translateX(-50vw);
width: 100vw;
left: 50%;
&[fluid='false'] {
transform: none;
width: initial;
left: initial;
}
}

.g-box, gallery-slider {
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
flex: 1;
order: 1;
height: 100%;
}
.g-no-transition {
transition: unset !important;
}

gallery-nav, .g-btn-close {
svg {
width: 100%;
.g-box,
gallery-slider {
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
flex: 1;
order: 1;
height: 100%;
filter: drop-shadow(0px 0px 1px black);
transition: opacity linear 0.2s;
opacity: 0.6;
&:hover {
opacity: 1;
}

gallery-nav,
.g-btn-close {
svg {
width: 100%;
height: 100%;
filter: drop-shadow(0px 0px 1px black);
transition: opacity linear 0.2s;
opacity: 0.6;
&:hover {
opacity: 1;
}
}
}
}
26 changes: 14 additions & 12 deletions projects/core/src/lib/styles/counter.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
.g-counter {
z-index: 50;
position: absolute;
left: 50%;
transform: translateX(-50%) perspective(1px);
bottom: 0;
font-size: 10px;
padding: 4px 10px;
color: white;
background-color: rgba(0, 0, 0, 0.5);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
::ng-deep {
.g-counter {
z-index: 50;
position: absolute;
left: 50%;
transform: translateX(-50%) perspective(1px);
bottom: 0;
font-size: 10px;
padding: 4px 10px;
color: white;
background-color: rgba(0, 0, 0, 0.5);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
}
57 changes: 29 additions & 28 deletions projects/core/src/lib/styles/dots.scss
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
gallery-dots {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 50%;
transform: translateX(-50%);
}
::ng-deep {
gallery-dots {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 50%;
transform: translateX(-50%);
}

.g-dot {
cursor: pointer;
display: flex;
justify-content: center;
z-index: 20;
}
.g-dot {
cursor: pointer;
display: flex;
justify-content: center;
z-index: 20;
}

.g-dot-active .g-dot-inner {
opacity: 1;
transform: scale(1.6);
}
.g-dot-active .g-dot-inner {
opacity: 1;
transform: scale(1.6);
}

.g-dot-inner {
background-color: white;
margin: 20px 15px;
opacity: 0.6;
width: 10px;
height: 5px;
border-radius: 1px;
box-shadow: 0 0 1px black;
transition: all ease 0.2s;
.g-dot-inner {
background-color: white;
margin: 20px 15px;
opacity: 0.6;
width: 10px;
height: 5px;
border-radius: 1px;
box-shadow: 0 0 1px black;
transition: all ease 0.2s;
}
}

45 changes: 24 additions & 21 deletions projects/core/src/lib/styles/navigations.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
.g-nav-next, .g-nav-prev {
position: absolute;
top: 50%;
width: 30px;
height: 40px;
cursor: pointer;
z-index: 999;
}

.g-nav-next {
right: 0.5em;
transform: translateY(-50%) perspective(1px);
}

.g-nav-prev {
left: 0.5em;
transform: translateY(-50%) perspective(1px) scale(-1, -1); //invert icon horizontally
}
::ng-deep {
.g-nav-next,
.g-nav-prev {
position: absolute;
top: 50%;
width: 30px;
height: 40px;
cursor: pointer;
z-index: 999;
}

@media only screen and (max-width: 480px) {
.g-nav-next {
right: 0.2em;
right: 0.5em;
transform: translateY(-50%) perspective(1px);
}

.g-nav-prev {
left: 0.2em;
left: 0.5em;
transform: translateY(-50%) perspective(1px) scale(-1, -1); //invert icon horizontally
}

@media only screen and (max-width: 480px) {
.g-nav-next {
right: 0.2em;
}

.g-nav-prev {
left: 0.2em;
}
}
}
30 changes: 16 additions & 14 deletions projects/core/src/lib/styles/slider.scss
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
.g-items-container {
height: 100%;
}

.g-slider {
position: absolute;
transition: transform 400ms cubic-bezier(0.5, 0, 0.5, 1);
}
::ng-deep {
.g-items-container {
height: 100%;
}

gallery-core[slidingDirection='horizontal'] {
.g-slider {
flex-direction: row;
position: absolute;
transition: transform 400ms cubic-bezier(0.5, 0, 0.5, 1);
}
}

gallery-core[slidingDirection='vertical'] {
.g-slider {
flex-direction: column;
gallery-core[slidingDirection='horizontal'] {
.g-slider {
flex-direction: row;
}
}

gallery-core[slidingDirection='vertical'] {
.g-slider {
flex-direction: column;
}
}
}
Loading

0 comments on commit ea041a5

Please sign in to comment.