Skip to content

Commit

Permalink
chore: use more css vars instead of hardcoded values
Browse files Browse the repository at this point in the history
  • Loading branch information
michielnijenhuis committed Aug 12, 2024
1 parent b590c7e commit d737ead
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 25 deletions.
7 changes: 7 additions & 0 deletions nuxt/assets/scss/defaults.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@
$value: $i * $increment;
--space-#{$i}: #{$value};
}

// Transitions
--transition-page-vertical: top 1s;
--transition-page-horizontal: left 1s;
--transition-slider: 0.15s ease-in-out;
--transition-accordeon: 0.4s ease-in-out;
--transition-state: all 0.3s ease;
}
16 changes: 8 additions & 8 deletions nuxt/assets/scss/transitions.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Transition to and from the art pages
*/
.up {
.up {
&.slide-leave-active,
&.slide-enter-active {
transition: top 1s;
transition: var(--transition-page-vertical);
}

&.slide-enter-from {
Expand All @@ -17,14 +17,14 @@

.down {
&.slide-leave-active {
transition: top 1s;
transition: var(--transition-page-vertical);
}

&.slide-leave-from {
top: 0;
}
&.slide-leave-to {
top: 100%
top: 100%;
}
}

Expand All @@ -34,14 +34,14 @@
.left {
&.slide-leave-active,
&.slide-enter-active {
transition: left 1s;
transition: var(--transition-page-horizontal);
}

&.slide-enter-from {
left: 100%;
}
&.slide-enter-to {
left: 0
left: 0;
}
&.slide-leave-to {
left: -100%;
Expand All @@ -54,15 +54,15 @@
.right {
&.slide-leave-active,
&.slide-enter-active {
transition: left 1s;
transition: var(--transition-page-horizontal);
}

&.slide-enter-from {
left: -100%;
}

&.slide-enter-to {
left: 0%
left: 0%;
}
&.slide-leave-to {
left: 100%;
Expand Down
6 changes: 2 additions & 4 deletions nuxt/components/Atoms/Accordeon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const toggle = () => {
cursor: pointer;
.icon {
transition: transform 0.3s ease;
transition: transform var(--transition-accordeon);
&.open {
transform: rotate(90deg) translate(0, 6px);
Expand All @@ -65,9 +65,7 @@ const toggle = () => {
&-body {
overflow: hidden;
transition-property: max-height, opacity;
transition-duration: 0.4s;
transition-timing-function: ease-in-out;
transition: max-height var(--transition-accordeon), opacity var(--transition-accordeon);
&.open {
max-height: 100vh;
Expand Down
2 changes: 1 addition & 1 deletion nuxt/components/Atoms/ArtworkTeaser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ defineProps<{
width: 100%;
height: 100%;
object-fit: cover;
transition: 0.15s ease-in-out;
transition: var(--transition-slider);
}
}
Expand Down
2 changes: 1 addition & 1 deletion nuxt/components/Atoms/CategoryTeaser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const to = computed(() => {
width: var(--max-width-slide);
height: 100%;
object-fit: cover;
transition: 0.15s ease-in-out;
transition: var(--transition-slider);
filter: blur(0.625rem);
position: absolute;
left: 50%;
Expand Down
2 changes: 1 addition & 1 deletion nuxt/components/Molecules/Form/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const clearInput = () => {
padding: var(--space-6);
border-radius: 50%;
background: var(--blues-blue);
color: white;
color: var(--primary-color);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion nuxt/components/organisms/CategorySlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const slideStyles = computed(() => {
background-color: var(--primary-color);
.category-slide {
transition: 0.15s ease-in-out;
transition: var(--transition-slider);
&:hover {
width: var(--max-width-slide) !important;
Expand Down
6 changes: 3 additions & 3 deletions nuxt/components/organisms/Create/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ onBeforeMount(async () => {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
gap: var(--space-4);
margin: 0 var(--space-20);
.actions {
display: flex;
align-items: center;
gap: 1rem;
gap: var(--space-4);
}
}
.preview {
display: flex;
overflow-x: scroll;
min-height: calc(100vh - 96px); // full height minus banner
min-height: calc(100vh - var(--space-24)); // full height minus banner
&-laptop {
max-height: 1080px;
Expand Down
10 changes: 5 additions & 5 deletions nuxt/components/organisms/Create/PreviewSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ onUnmounted(() => {
.divider {
background-color: #8c8c8c;
height: 1px;
height: var(--space-0);
width: 100%;
margin: var(--space-2) 0 var(--space-2);
}
Expand Down Expand Up @@ -308,13 +308,13 @@ onUnmounted(() => {
}
.responsive-view-button {
width: 88px;
height: 65px;
width: var(--space-22);
height: var(--space-16);
border: 2px solid gray;
transition: all 0.2s ease;
transition: var(--transition-state);
svg {
transition: color 0.2s ease;
transition: var(--transition-state);
}
&:hover,
Expand Down
2 changes: 1 addition & 1 deletion nuxt/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ a {
text-decoration: none;
color: white;
padding: var(--space-2);
transition: color 0.3s ease;
transition: var(--transition-state);
&:hover {
color: blue;
Expand Down

0 comments on commit d737ead

Please sign in to comment.