Skip to content

Commit

Permalink
♻️ #4 - refactor: refactor previous components sass files to use nest…
Browse files Browse the repository at this point in the history
…ed syntax for BEM elements
  • Loading branch information
svenvandescheur committed Jan 11, 2024
1 parent 30b240b commit 8a848f2
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 75 deletions.
42 changes: 21 additions & 21 deletions src/components/layout/column/column.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@

.mykn-column {
grid-column: auto / 6 span;
}

.mykn-column--debug {
outline: 1px solid blue;
}
&--debug {
outline: 1px solid blue;
}

.mykn-column--debug:before {
color: blue;
content: "Mobile (full span)";
display: block;
font-family: monospace;
text-align: center;
}
&--debug:before {
color: blue;
content: "Mobile (full span)";
display: block;
font-family: monospace;
text-align: center;
}

.mykn-column--debug[data-testid]:before {
content: attr(data-testid)!important;
}
&--debug[data-testid]:before {
content: attr(data-testid)!important;
}

@media screen and (min-width: style.$breakpoint-desktop) {
@for $i from 1 through 12 {
.mykn-column--span-#{$i} {
grid-column: auto / span #{$i};
}
@media screen and (min-width: style.$breakpoint-desktop) {
@for $i from 1 through 12 {
&--span-#{$i} {
grid-column: auto / span #{$i};
}

.mykn-column--debug.mykn-column--span-#{$i}:before {
content: "Span #{$i}";
&--debug#{&}--span-#{$i}:before {
content: "Span #{$i}";
}
}
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/components/layout/container/container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
margin: 0 auto;
max-width: 1240px;
width: 100%;
}

.mykn-container--debug {
outline: 1px solid red;
}
&--debug {
outline: 1px solid red;
}

.mykn-container--debug[data-testid]:before {
content: attr(data-testid);
color: red;
display: block;
font-family: monospace;
text-align: center;
}
&--debug[data-testid]:before {
content: attr(data-testid);
color: red;
display: block;
font-family: monospace;
text-align: center;
}

.mykn-container--debug[data-testid]:before {
content: attr(data-testid);
&--debug[data-testid]:before {
content: attr(data-testid);
}
}
38 changes: 19 additions & 19 deletions src/components/layout/grid/grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
grid-template-columns: repeat(6, auto);
gap: 12px;
width: 100%;
}

.mykn-grid--debug {
outline: 1px solid green;
}
&--debug {
outline: 1px solid green;
}

.mykn-grid--debug[data-testid]:before {
content: attr(data-testid);
color: green;
display: block;
font-family: monospace;
grid-column: 1 / 12 span;
text-align: center;
}
&--debug[data-testid]:before {
content: attr(data-testid);
color: green;
display: block;
font-family: monospace;
grid-column: 1 / 12 span;
text-align: center;
}

.mykn-grid--debug[data-testid]:before {
content: attr(data-testid);
}
&--debug[data-testid]:before {
content: attr(data-testid);
}

@media screen and (min-width: style.$breakpoint-desktop) {
.mykn-grid {
grid-template-columns: repeat(12, auto);
gap: 32px;
@media screen and (min-width: style.$breakpoint-desktop) {
& {
grid-template-columns: repeat(12, auto);
gap: 32px;
}
}
}
46 changes: 24 additions & 22 deletions src/components/logo/logo.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
.mykn-logo .mykn-logo__image {
width: 100%;
object-fit: contain;
max-width: 155px;
overflow: visible;
}
.mykn-logo {
&__image {
width: 100%;
object-fit: contain;
max-width: 155px;
overflow: visible;
}

.mykn-logo .mykn-logo__handle {
transition: transform var(--animation-duration) var(--animation-timing-function);
}
& &__handle {
transition: transform var(--animation-duration) var(--animation-timing-function);
}

.mykn-logo[href]:hover .mykn-logo__handle--left,
.mykn-logo[href]:focus .mykn-logo__handle--left {
transform: translateX(-2px);
}
&[href]:hover &__handle--left,
&[href]:focus &__handle--left {
transform: translateX(-2px);
}

.mykn-logo[href]:active .mykn-logo__handle--left {
transform: translateX(2px);
}
&[href]:active &__handle--left {
transform: translateX(2px);
}

.mykn-logo[href]:hover .mykn-logo__handle--right,
.mykn-logo[href]:focus .mykn-logo__handle--right {
transform: translateX(2px);
}
&[href]:hover &__handle--right,
&[href]:focus &__handle--right {
transform: translateX(2px);
}

.mykn-logo[href]:active .mykn-logo__handle--right {
transform: translateX(-2px);
&[href]:active &__handle--right {
transform: translateX(-2px);
}
}

0 comments on commit 8a848f2

Please sign in to comment.