Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding base motion tokens for duration and easing #1080

Merged
merged 6 commits into from
Nov 21, 2024
Merged

Conversation

lukasoppermann
Copy link
Contributor

@lukasoppermann lukasoppermann commented Oct 30, 2024

Summary

This PR adds a numeric scale for motion durations (used for css transitions and delays) and 4 generic easing curves.

Steps to test:

Copy link

changeset-bot bot commented Oct 30, 2024

🦋 Changeset detected

Latest commit: ea69900

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/primitives Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 30, 2024

Design Token Diff

/css/functional/motion/motion.css

+++ /home/runner/work/primitives/primitives/dist/css/functional/motion/motion.css	2024-11-21 09:42:30.010712799 +0000
@@ -1,5 +1,6 @@
:root {
-  --motion-loading-delay-default: 1s; /* The amount of time to wait before showing a loading indicator or announcing a loading state to assistive technologies. */
-  --motion-spinner-duration-rotation: 1s; /* The amount of time it takes the "Spinner" loading indicator to make a full 360deg rotation */
-  --motion-skeletonLoader-shimmer-duration-scale: 1s; /* The amount of times it takes the "shimmer" effect to go from the start (left) of the skeleton loader to the end (right) */
+  --motion-loading-delay-default: var(--base-duration-1000); /* The amount of time to wait before showing a loading indicator or announcing a loading state to assistive technologies. */
+  --motion-spinner-duration-rotation: var(--base-duration-1000); /* The amount of time it takes the "Spinner" loading indicator to make a full 360deg rotation */
+  --motion-spinner-easing-rotation: var(--base-easing-linear); /* The easing curve for the "Spinner" loading indicator rotation */
+  --motion-skeletonLoader-shimmer-duration-scale: var(--base-duration-1000); /* The amount of times it takes the "shimmer" effect to go from the start (left) of the skeleton loader to the end (right) */
}

/css/primitives.css

+++ /home/runner/work/primitives/primitives/dist/css/primitives.css	2024-11-21 09:42:30.262716600 +0000
@@ -1,4 +1,21 @@
:root {
+  --base-easing-linear: cubic-bezier(0, 0, 1, 1); /* Ideal for non-movement properties, like opacity or background color. */
+  --base-easing-easeIn: cubic-bezier(0.7, 0.1, 0.75, 0.9); /* Ideal for movement that starts on the page and ends off the page. */
+  --base-easing-easeOut: cubic-bezier(0.16, 1, 0.3, 1); /* Ideal for movement that starts off the page and ends on the page. */
+  --base-easing-easeInOut: cubic-bezier(0.6, 0, 0.2, 1); /* Ideal for movement that starts and ends on the page. */
+  --base-duration-0: 0ms;
+  --base-duration-75: 75ms;
+  --base-duration-200: 200ms;
+  --base-duration-300: 300ms;
+  --base-duration-400: 400ms;
+  --base-duration-500: 500ms;
+  --base-duration-600: 600ms;
+  --base-duration-700: 700ms;
+  --base-duration-800: 800ms;
+  --base-duration-900: 900ms;
+  --base-duration-1000: 1s;
+}
+:root {
 --base-size-2: 0.125rem;
 --base-size-4: 0.25rem;
 --base-size-6: 0.375rem;
@@ -26,9 +43,10 @@
 --base-text-weight-semibold: 600;
}
:root {
-  --motion-loading-delay-default: 1s; /* The amount of time to wait before showing a loading indicator or announcing a loading state to assistive technologies. */
-  --motion-spinner-duration-rotation: 1s; /* The amount of time it takes the "Spinner" loading indicator to make a full 360deg rotation */
-  --motion-skeletonLoader-shimmer-duration-scale: 1s; /* The amount of times it takes the "shimmer" effect to go from the start (left) of the skeleton loader to the end (right) */
+  --motion-loading-delay-default: var(--base-duration-1000); /* The amount of time to wait before showing a loading indicator or announcing a loading state to assistive technologies. */
+  --motion-spinner-duration-rotation: var(--base-duration-1000); /* The amount of time it takes the "Spinner" loading indicator to make a full 360deg rotation */
+  --motion-spinner-easing-rotation: var(--base-easing-linear); /* The easing curve for the "Spinner" loading indicator rotation */
+  --motion-skeletonLoader-shimmer-duration-scale: var(--base-duration-1000); /* The amount of times it takes the "shimmer" effect to go from the start (left) of the skeleton loader to the end (right) */
}
:root {
 --boxShadow-thin: inset 0 0 0 max(1px, 0.0625rem); /* Thin shadow for borders */

@langermank langermank added the update snapshots Update visual regression test snapshots label Nov 20, 2024
Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is very clear 👍 and easy to extend of modify as we start using them

Comment on lines +32 to +33
warnings: 'disabled', // 'warn' | 'error' | 'disabled'
verbosity: 'silent', // 'default' | 'silent' | 'verbose'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this fix our very loud build? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In part it does remove some clutter, but not all. Will have to experiment with this.

@github-actions github-actions bot removed the update snapshots Update visual regression test snapshots label Nov 20, 2024
@github-actions github-actions bot temporarily deployed to Preview (Storybook) November 20, 2024 15:54 Inactive
@lukasoppermann lukasoppermann marked this pull request as ready for review November 20, 2024 16:05
@lukasoppermann lukasoppermann requested review from a team as code owners November 20, 2024 16:05
@github-actions github-actions bot temporarily deployed to Preview (Storybook) November 21, 2024 09:43 Inactive
@lukasoppermann lukasoppermann merged commit ab5ab6b into main Nov 21, 2024
26 checks passed
@lukasoppermann lukasoppermann deleted the motion branch November 21, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants