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

feat: Add backgroundColor var on LoadingDots #2991

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
79ff388
fix: Update Contributing guide link
ahayes91 Oct 21, 2024
e265c60
feat(a11y): allow loading dots color to be set as a var and update st…
ahayes91 Oct 21, 2024
6af3be6
fix: update the TS interface on LoadingDots with the new backgroundCo…
ahayes91 Oct 21, 2024
554db45
fix: update PR template link to docs guidelines
ahayes91 Oct 21, 2024
6ded390
Merge branch 'prerelease/minor' into loading-dots-a11y-example
ahayes91 Oct 22, 2024
c8e2bf4
Merge branch 'prerelease/minor' into loading-dots-a11y-example
ahayes91 Oct 23, 2024
7f66459
Merge branch 'prerelease/minor' into loading-dots-a11y-example
ahayes91 Oct 25, 2024
f4f6e04
chore: update storybook with a circle variant and revert a11y changes
ahayes91 Oct 25, 2024
db213f0
fix: Update Select to open with spacebar (#3006)
mannycarrera4 Oct 28, 2024
a8c9591
chore: Release v11.1.19 [skip release]
alanbsmith Oct 28, 2024
928df77
chore: Merge support into master
Oct 28, 2024
8320058
chore: Merge support into master
Oct 28, 2024
0b9f1d2
chore: Merge support into master
Oct 28, 2024
02051e2
Merge branch 'merge/support-into-master' of https://github.com/Workda…
Oct 28, 2024
e99cd4f
chore: Merge support into master
Oct 28, 2024
bc611c1
chore: Merge support into master (#3008)
alanbsmith Oct 29, 2024
b97cf70
fix: apply suggestions from PR review for better stencils!
ahayes91 Oct 29, 2024
dbfa314
Merge branch 'master' into loading-dots-a11y-example
ahayes91 Oct 30, 2024
bac77df
fix: rename circle variant and show example for props
ahayes91 Oct 30, 2024
9b5520b
chore: revert change that creeped in with master
ahayes91 Oct 31, 2024
ed99621
fix: update the stories & docs links
ahayes91 Oct 31, 2024
37f0f71
chore: remove changes to changelog from master merge
ahayes91 Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Optional breaking changes message. If your PR includes breaking changes. It is e

## Checklist

- [ ] MDX documentation adheres to Canvas Kit's [Documentation Guidelines](https://workday.github.io/canvas-kit/?path=/docs/guides-documentation-guidelines--page)
- [ ] MDX documentation adheres to Canvas Kit's [Documentation Guidelines](https://workday.github.io/canvas-kit/?path=/docs/guides-documentation-guidelines--docs)
- [ ] Label `ready for review` has been added to PR

## For the Reviewer
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to Canvas

You may read our contribution guidelines
[here](https://workday.github.io/canvas-kit/?path=/docs/guides-contributing--page).
[here](https://workday.github.io/canvas-kit/?path=/docs/guides-contributing--docs).
25 changes: 18 additions & 7 deletions modules/react/loading-dots/lib/LoadingDots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const keyframesLoading = keyframes({
const singleLoadingDotStencil = createStencil({
ahayes91 marked this conversation as resolved.
Show resolved Hide resolved
vars: {
animationDurationMs: '40ms',
},
base: ({animationDurationMs}) => ({
backgroundColor: system.color.bg.alt.strong,
},
base: ({animationDurationMs, backgroundColor}) => ({
backgroundColor,
width: system.space.x4,
height: system.space.x4,
fontSize: system.space.zero,
Expand All @@ -44,10 +45,20 @@ const singleLoadingDotStencil = createStencil({
}),
});

export interface LoadingDotsProps extends CSProps {
/**
* Applies backgroundColor to loading dots, intended for use with the circle variant design on grey/dark/image-based backgrounds.
* @default `system.color.bg.alt.strong`
*/
backgroundColor?: string;
}

/**
* The actual loading dot div.
*/
const LoadingAnimationDot = () => <div {...singleLoadingDotStencil()} />;
const LoadingAnimationDot = ({backgroundColor}: LoadingDotsProps) => (
<div {...singleLoadingDotStencil({backgroundColor})} />
);

/**
* A simple container for the loading dots.
Expand All @@ -64,12 +75,12 @@ const loadingDotsStencil = createStencil({
*/
export const LoadingDots = createComponent('div')({
displayName: 'LoadingDots',
Component: (elemProps: CSProps, ref, Element) => {
Component: ({backgroundColor, ...elemProps}: LoadingDotsProps, ref, Element) => {
return (
<Element ref={ref} {...handleCsProp(elemProps, loadingDotsStencil())}>
<LoadingAnimationDot />
<LoadingAnimationDot />
<LoadingAnimationDot />
<LoadingAnimationDot backgroundColor={backgroundColor} />
<LoadingAnimationDot backgroundColor={backgroundColor} />
<LoadingAnimationDot backgroundColor={backgroundColor} />
</Element>
);
},
Expand Down
18 changes: 14 additions & 4 deletions modules/react/loading-dots/stories/examples/Accessible.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {LoadingDots} from '@workday/canvas-kit-react/loading-dots';
import {base, system} from '@workday/canvas-tokens-web';
import {system} from '@workday/canvas-tokens-web';
import {Flex} from '@workday/canvas-kit-react/layout';
import {SecondaryButton} from '@workday/canvas-kit-react/button';
import {createStyles} from '@workday/canvas-kit-styling';
Expand All @@ -11,8 +11,13 @@ const styleOverrides = {
gap: system.space.x4,
}),
loadingStyles: createStyles({
backgroundColor: system.color.bg.muted.default,
padding: system.space.x3,
borderRadius: system.shape.round,
backgroundColor: system.color.bg.overlay,
height: 80,
width: 80,
alignItems: 'center',
justifyContent: 'center',
display: 'flex',
ahayes91 marked this conversation as resolved.
Show resolved Hide resolved
}),
};

Expand Down Expand Up @@ -40,7 +45,12 @@ export const Accessible = () => {
<SecondaryButton onClick={handleLoad}>Start</SecondaryButton>
<AriaLiveRegion aria-label="Loading">
{loadingState === 'loading' && (
<LoadingDots cs={styleOverrides.loadingStyles} role="img" aria-label="Please wait..." />
<LoadingDots
cs={styleOverrides.loadingStyles}
backgroundColor={system.color.icon.inverse}
role="img"
aria-label="Please wait..."
/>
)}
{loadingState === 'success' && <AccessibleHide>Complete.</AccessibleHide>}
</AriaLiveRegion>
Expand Down
Loading