Skip to content

Commit

Permalink
🐛 [LightningCss] Find a solution to global keyframes
Browse files Browse the repository at this point in the history
  • Loading branch information
beefchimi committed Nov 22, 2024
1 parent f5c7c07 commit e6d014d
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This template provides a minimal setup to get React working in Vite with HMR and

## Tasks

- Update all instances of `@media`.
- Figure out how to import `@custom-media` globally, so that we do not need to `@import` it in every file.
- See if I can replace all `mixin` instances with `CSS Modules > composes`.
- <https://lightningcss.dev/css-modules.html>
- Update `Button` styles.
Expand Down
1 change: 1 addition & 0 deletions src/components/primitives/Spinner/Spinner.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
border: 0.125em solid var(--shade-white-20);
border-top: 0.125em solid var(--shade-white-80);
border-radius: 50%;
animation: var(--motion-spin) var(--speed-slow) var(--ease) infinite both;
}
4 changes: 2 additions & 2 deletions src/components/primitives/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {clamp, clx} from 'beeftools';
import {clamp} from 'beeftools';

import styles from './Spinner.module.css';

Expand All @@ -22,7 +22,7 @@ export function Spinner({size = 16, ariaLabel = 'Loading…'}: SpinnerProps) {
style={{fontSize: safeSize}}
data-spinner="simple"
>
<div className={clx(styles.Icon, 'motion-spin')} />
<div className={styles.Icon} />
<p className="visually-hidden">{ariaLabel}</p>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@import '@src/styles/media-queries.css';

.YouTubeEmbed {
padding: 20px;
width: 100%;
max-width: var(--breakpoint-x-widescreen);

@media (min-width: 1080px) {
@media (--min-hd) {
padding: 32px;
}

Expand Down
4 changes: 3 additions & 1 deletion src/components/sections/Footer/Footer.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '@src/styles/media-queries.css';

.Footer {
--footer-action-padding: 6px;
--footer-underline-width: 0%;
Expand All @@ -6,7 +8,7 @@
width: 100%;
text-align: center;

@media (min-width: 1280px) {
@media (--min-desktop) {
padding: 40px;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/sections/Header/Header.module.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@import '@src/styles/media-queries.css';

.Header {
padding: 20px;
width: 100%;
text-align: center;

@media (min-width: 1280px) {
@media (--min-desktop) {
padding: 40px;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/sections/Main/Main.module.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@import '@src/styles/media-queries.css';

.Main {
padding: 20px;
width: 100%;
text-align: center;

@media (min-width: 1280px) {
@media (--min-desktop) {
padding: 40px;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/ui/Accordion/Accordion.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '@src/styles/media-queries.css';

.Accordion {
--accordion-title-size: 20px;
--accordion-icon-rotate: 0deg;
Expand All @@ -13,15 +15,15 @@

display: grid;

@media (min-width: 768px) {
@media (--min-tablet) {
--accordion-title-size: 24px;
}
}

.smallTitle {
--accordion-title-size: 16px;

@media (min-width: 768px) {
@media (--min-tablet) {
--accordion-title-size: 18px;
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/styles/keyframes.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
}
}

/* TODO: Figure out how to use `:global()` keyframes in `lightningcss`. */
.motion-spin {
animation: motionSpin var(--speed-slow) var(--ease) infinite both;
:root {
/*
TODO: Figure out how to use `:global()` keyframes in `lightningcss`.
https://github.com/parcel-bundler/lightningcss/issues/825
*/
--motion-fade-in: motionFadeIn;
--motion-spin: motionSpin;
}

0 comments on commit e6d014d

Please sign in to comment.