Skip to content

Commit

Permalink
removing hover mixin (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephiescastle authored Jun 28, 2024
1 parent 5578b02 commit 6286d2c
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 85 deletions.
7 changes: 0 additions & 7 deletions apps/html-storybook/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,5 @@ export default defineConfig({
// because pnpm and stories are in node_modules
resolve: {
preserveSymlinks: true
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@explorer-1/common/src/scss/_hover.scss";`
}
}
}
})
7 changes: 0 additions & 7 deletions apps/vue-storybook/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,5 @@ export default defineConfig({
watch: {
usePolling: true
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@explorer-1/common/src/scss/_hover.scss";`
}
}
}
})
12 changes: 0 additions & 12 deletions packages/common/src/scss/_hover.scss

This file was deleted.

20 changes: 10 additions & 10 deletions packages/common/src/scss/components/_BaseButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@apply flex h-full items-center justify-center;
}

@include hover {
&:hover {
background-position: bottom;
}

Expand All @@ -28,15 +28,15 @@
&.-secondary {
@apply px-12 bg-transparent text-action border-2 border-action to-action-dark-w50;

@include hover {
&:hover {
@apply text-white border-action-dark;
}
}

&.-dark {
@apply px-12 bg-transparent text-white border border-white/40 to-white-w50;

@include hover {
&:hover {
@apply text-dark-blue edu:text-primary-dark border-white bg-white;
}
}
Expand All @@ -48,52 +48,52 @@
&.-social {
@apply px-12 bg-transparent border border-gray-mid text-gray-mid to-gray-dark-w50;

@include hover {
&:hover {
@apply text-white bg-gray-dark;
}

&.-facebook {
@apply to-facebook-w50;

@include hover {
&:hover {
@apply bg-facebook border-facebook;
}
}

&.-twitter {
@apply to-twitter-w50;

@include hover {
&:hover {
@apply bg-twitter border-twitter;
}
}

&.-instagram {
@apply to-instagram-w50;

@include hover {
&:hover {
@apply bg-instagram border-instagram;
}
}

&.-youtube {
@apply to-youtube-w50;

@include hover {
&:hover {
@apply bg-youtube border-youtube;
}
}

&.-reddit {
@apply to-reddit-w50;

@include hover {
&:hover {
@apply bg-reddit border-reddit;
}
}
.ThemeEdu & {
@apply border-action text-action to-action-w50 #{!important};
@include hover {
&:hover {
@apply text-white bg-action #{!important};
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/scss/components/_BaseImageCaption.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
a {
@apply text-action underline cursor-pointer;

@include hover {
&:hover {
@apply text-action-hover;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/scss/components/_BlockText.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
a {
@apply text-action underline cursor-pointer break-words;

@include hover {
&:hover {
@apply text-action-hover;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
}

@include hover {
&:hover {
> .arrow-wrapper > .arrow {
animation: arrow-anim 0.25s ease-in normal;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/scss/components/_MixinCarousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
}

@include hover {
&:hover {
> .arrow-wrapper > .arrow,
> .arrow-wrapper > .arrow-fixed {
animation-delay: 50ms !important; // hover intent
Expand All @@ -46,7 +46,7 @@
@screen lg {
// specific directional animation
.swiper-next.BaseButton > .label {
@include hover {
&:hover {
> .arrow-wrapper > .arrow {
animation: arrow-carousel-next-anim 0.1s linear normal;
}
Expand All @@ -58,7 +58,7 @@
}

.swiper-prev.BaseButton > .label {
@include hover {
&:hover {
> .arrow-wrapper > .arrow {
animation: arrow-carousel-prev-anim 0.1s linear normal;
}
Expand Down
25 changes: 17 additions & 8 deletions packages/common/src/scss/components/_NavInternal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
visibility: hidden;
max-height: 0;
opacity: 0;
transition: visibility 0s linear 300ms, opacity 300ms,
transition:
visibility 0s linear 300ms,
opacity 300ms,
max-height 0s linear 300s;
@apply h-0 overflow-hidden;

Expand All @@ -36,7 +38,10 @@
visibility: visible;
max-height: 100%;
opacity: 1;
transition: visibility 0s, opacity 300ms, max-height 0s;
transition:
visibility 0s,
opacity 300ms,
max-height 0s;
@apply h-auto overflow-visible;

@screen lg {
Expand Down Expand Up @@ -86,7 +91,7 @@
@apply border-gray-dark/20 outline-none;
}

@include hover {
&:hover {
@apply text-gray-mid-dark;
}
// bold invisible psuedo element to prevent layout shift on hover
Expand Down Expand Up @@ -228,7 +233,7 @@
@apply border-b border-transparent;
}

@include hover {
&:hover {
@apply text-jpl-sky-blue;
}

Expand Down Expand Up @@ -269,7 +274,7 @@
}
}

@include hover {
&:hover {
@apply text-gray-dark;

> span {
Expand All @@ -284,7 +289,7 @@
@apply border-0;
}

@include hover {
&:hover {
@apply text-jpl-sky-blue;
}

Expand Down Expand Up @@ -353,12 +358,16 @@
// complex transitions, so cannot use tailwind classes
visibility: visible;
opacity: 0.8;
transition: visibility 0s linear 0s, opacity 300ms;
transition:
visibility 0s linear 0s,
opacity 300ms;
// must use a custom class, cannot use .invisible, or else other rules will get erroneously created
// see: https://github.jpl.nasa.gov/18x/WCP/issues/492
&.invisible-overlay {
visibility: hidden;
opacity: 0;
transition: visibility 0s linear 300ms, opacity 300ms;
transition:
visibility 0s linear 300ms,
opacity 300ms;
}
}
2 changes: 0 additions & 2 deletions packages/common/src/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

// main elements
@import 'forms';
@import 'hover';
@import 'fonts';
@import 'aspect-ratios';
@import 'grid';
Expand All @@ -26,4 +25,3 @@

// components
@import 'components';

3 changes: 1 addition & 2 deletions packages/html/dist/assets/css/explorer-1.min.css

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions packages/html/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@explorer-1/common/src/scss/_hover.scss";`
}
}
},
build: {
rollupOptions: {
output: {
Expand Down
8 changes: 0 additions & 8 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ export default defineNuxtModule<ModuleOptions>({
// extend nuxt's vite config without overriding nuxt.config.js
nuxt.options.vite = {
...nuxt.options.vite,
css: {
...nuxt.options.css,
preprocessorOptions: {
scss: {
additionalData: `@import "@explorer-1/common/src/scss/_hover.scss";`
}
}
},
build: {
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export default defineComponent({
@apply absolute top-0 left-0 block;
}
}
@include hover {
&:hover {
> .arrow-wrapper > .arrow,
> .arrow-wrapper > .arrow-fixed {
animation-delay: 50ms !important; // hover intent
Expand All @@ -245,7 +245,7 @@ export default defineComponent({
@screen lg {
// specific directional animation
.swiper-next.BaseButton > .label {
@include hover {
&:hover {
> .arrow-wrapper > .arrow {
animation: arrow-carousel-next-anim 0.1s linear normal;
}
Expand All @@ -257,7 +257,7 @@ export default defineComponent({
}
.swiper-prev.BaseButton > .label {
@include hover {
&:hover {
> .arrow-wrapper > .arrow {
animation: arrow-carousel-prev-anim 0.1s linear normal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default defineComponent({
}
}
}
@include hover {
&:hover {
> span {
@apply border-jpl-red;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default defineComponent({
@apply border-primary #{!important};
}
}
@include hover {
&:hover {
&.-active {
> span {
@apply text-gray-mid-dark;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default defineComponent({
@apply border-b border-transparent pb-2px;
}
@include hover {
&:hover {
> span {
@apply border-black text-black;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/components/NavSocial/NavSocial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineComponent({
<style lang="scss" scoped>
.BaseButton {
@apply relative;
@include hover {
&:hover {
@apply z-10;
}
// we have to define these here to override the extracted border styles native to BaseButton
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/components/ShareButtons/ShareButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default defineComponent({
.ShareButtons {
.BaseButton {
@apply relative;
@include hover {
&:hover {
@apply z-10;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const buttonClass = computed(() => {
.ShareButtonsEdu {
.BaseButton {
@apply relative focus:z-20;
@include hover {
&:hover {
@apply z-20;
}
}
Expand Down
7 changes: 0 additions & 7 deletions packages/vue/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ export default defineConfig({
dirs: ['./src/components', './src/templates']
})
],
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@explorer-1/common/src/scss/_hover.scss";`
}
}
},
// build: {
// rollupOptions: {
// output: {
Expand Down

0 comments on commit 6286d2c

Please sign in to comment.