carbon
carbon copied to clipboard
feat(preview): add `shape` and `disableAnimation` props
Proposed behaviour
- Adds
shape
prop - "text", "rectangle", "rectangle-round" and "circle". - Adds the
disableAnimation
prop to disable the loading animation, this can be set manually or will automatically be true when prefer reduce-motion is enabled. - Updates background colour to a gradient.
Current behaviour
- Preview does not have a
shape
prop. - Preview does not handle prefer reduce-motion.
Checklist
- [x] Commits follow our style guide
- [ ] Related issues linked in commit messages if required
- [x] Screenshots are included in the PR if useful
- [ ] All themes are supported if required
- [x] Unit tests added or updated if required
- [x] Playwright automation tests added or updated if required
- [x] Storybook added or updated if required
- [ ] Translations added or updated (including creating or amending translation keys table in storybook) if required
- [ ] Typescript
d.ts
file added or updated if required - [x] Related docs have been updated if required
QA
- [ ] Tested in provided StackBlitz sandbox/Storybook
- [ ] Add new Playwright test coverage if required
- [ ] Carbon implementation matches Design System/designs
- [ ] UI Tests GitHub check reviewed if required
Additional context
Testing instructions
- Shape variations should support changes to dimensions using
width
andheight
props. - The "circle" shape uses
height
as its diameter, ignoring thewidth
. - The
lines
prop should render specified number of Preview shapes. - When shape is "text", if more than one line, the last line should be 80% of the width.
- Prefer reduce-motion should remove animation.