Skip to content

PLASMA-5253: add animation duration for Skeleton - #3024

Open
oki1oki wants to merge 2 commits into
devfrom
PLASMA-5253
Open

PLASMA-5253: add animation duration for Skeleton#3024
oki1oki wants to merge 2 commits into
devfrom
PLASMA-5253

Conversation

@oki1oki

@oki1oki oki1oki commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Core

Skeleton

  • добавлено свойство animationDuration для управления скоростью анимации

What/why changed

  • добавлено свойство animationDuration для управления скоростью анимации Skeleton
📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @salutejs/plasma-asdk@0.387.0-canary.3024.31101721137.0
npm install @salutejs/plasma-b2c@1.629.0-canary.3024.31101721137.0
npm install @salutejs/plasma-colors@0.18.0-canary.3024.31101721137.0
npm install @salutejs/plasma-core@1.236.0-canary.3024.31101721137.0
npm install @salutejs/plasma-giga@0.356.0-canary.3024.31101721137.0
npm install @salutejs/plasma-homeds@0.356.0-canary.3024.31101721137.0
npm install @salutejs/plasma-hope@1.383.0-canary.3024.31101721137.0
npm install @salutejs/plasma-icons@1.245.0-canary.3024.31101721137.0
npm install @salutejs/plasma-new-hope@0.373.0-canary.3024.31101721137.0
npm install @salutejs/plasma-tokens@1.147.0-canary.3024.31101721137.0
npm install @salutejs/plasma-tokens-b2b@1.61.0-canary.3024.31101721137.0
npm install @salutejs/plasma-tokens-b2c@0.72.0-canary.3024.31101721137.0
npm install @salutejs/plasma-tokens-core@0.9.0-canary.3024.31101721137.0
npm install @salutejs/plasma-tokens-web@1.76.0-canary.3024.31101721137.0
npm install @salutejs/plasma-typo@0.49.0-canary.3024.31101721137.0
npm install @salutejs/plasma-web@1.631.0-canary.3024.31101721137.0
npm install @salutejs/sdds-bizcom@0.361.0-canary.3024.31101721137.0
npm install @salutejs/sdds-cs@0.365.0-canary.3024.31101721137.0
npm install @salutejs/sdds-dfa@0.359.0-canary.3024.31101721137.0
npm install @salutejs/sdds-finai@0.352.0-canary.3024.31101721137.0
npm install @salutejs/sdds-insol@0.356.0-canary.3024.31101721137.0
npm install @salutejs/sdds-insol-next@0.355.0-canary.3024.31101721137.0
npm install @salutejs/sdds-netology@0.360.0-canary.3024.31101721137.0
npm install @salutejs/sdds-os@0.31.0-canary.3024.31101721137.0
npm install @salutejs/sdds-platform-ai@0.360.0-canary.3024.31101721137.0
npm install @salutejs/sdds-sbcom@0.361.0-canary.3024.31101721137.0
npm install @salutejs/sdds-scan@0.359.0-canary.3024.31101721137.0
npm install @salutejs/sdds-serv@0.360.0-canary.3024.31101721137.0
npm install @salutejs/core-themes@0.37.0-canary.3024.31101721137.0
npm install @salutejs/plasma-themes@0.59.0-canary.3024.31101721137.0
npm install @salutejs/sdds-themes@0.74.0-canary.3024.31101721137.0
npm install @salutejs/sdds-api-tests@0.18.0-canary.3024.31101721137.0
npm install @salutejs/plasma-cy-utils@0.166.0-canary.3024.31101721137.0
npm install @salutejs/plasma-sb-utils@0.237.0-canary.3024.31101721137.0
npm install @salutejs/plasma-tokens-utils@0.57.0-canary.3024.31101721137.0
# or 
yarn add @salutejs/plasma-asdk@0.387.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-b2c@1.629.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-colors@0.18.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-core@1.236.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-giga@0.356.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-homeds@0.356.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-hope@1.383.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-icons@1.245.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-new-hope@0.373.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-tokens@1.147.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-tokens-b2b@1.61.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-tokens-b2c@0.72.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-tokens-core@0.9.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-tokens-web@1.76.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-typo@0.49.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-web@1.631.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-bizcom@0.361.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-cs@0.365.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-dfa@0.359.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-finai@0.352.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-insol@0.356.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-insol-next@0.355.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-netology@0.360.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-os@0.31.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-platform-ai@0.360.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-sbcom@0.361.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-scan@0.359.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-serv@0.360.0-canary.3024.31101721137.0
yarn add @salutejs/core-themes@0.37.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-themes@0.59.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-themes@0.74.0-canary.3024.31101721137.0
yarn add @salutejs/sdds-api-tests@0.18.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-cy-utils@0.166.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-sb-utils@0.237.0-canary.3024.31101721137.0
yarn add @salutejs/plasma-tokens-utils@0.57.0-canary.3024.31101721137.0

Summary by CodeRabbit

  • New Features

    • Added configurable animation duration for LineSkeleton, RectSkeleton, and TextSkeleton.
    • Added duration configuration for withSkeleton through animationConfig.duration.
    • Supports custom durations in milliseconds while preserving default animations.
  • Documentation

    • Added usage examples and guidance across component documentation.
    • Corrected several Skeleton examples and package references.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds millisecond-based animation duration overrides to skeleton components and the withSkeleton HOC. It forwards these values to shimmer and pulse styles, updates Storybook controls, and documents the new configuration across product documentation sites.

Changes

Skeleton animation duration

Layer / File(s) Summary
Skeleton component duration propagation
packages/plasma-new-hope/src/components/Skeleton/...
LineSkeleton, RectSkeleton, and TextSkeleton accept and forward animationDuration. Styles use the value in milliseconds and retain default duration tokens when it is absent.
withSkeleton duration configuration
packages/plasma-new-hope/src/components/Skeleton/hoc/..., utils/plasma-sb-utils/src/components/Skeleton/stories.tsx
AnimationConfig supports duration. withSkeleton forwards it to Wrapper, and stories expose it for shimmer and pulse configurations.
Duration documentation and examples
packages/plasma-new-hope/src/components/Skeleton/Skeleton.template-doc.mdx, website/*/docs/components/Skeleton.mdx
Documentation describes animationDuration and animationConfig.duration in milliseconds. Several examples also correct imports or unsupported property values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: titankuzmich, yakutoc, neretin-trike

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding animation duration support to Skeleton components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PLASMA-5253

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Theme Builder app deployed!

https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-3024/

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Documentation preview deployed!

website: https://plasma.sberdevices.ru/pr/pr-3024/
asdk storybook: https://plasma.sberdevices.ru/pr/pr-3024/asdk-storybook/
b2c storybook: https://plasma.sberdevices.ru/pr/pr-3024/b2c-storybook/
giga storybook: https://plasma.sberdevices.ru/pr/pr-3024/giga-storybook/
homeds storybook: https://plasma.sberdevices.ru/pr/pr-3024/homeds-storybook/
new-hope storybook: https://plasma.sberdevices.ru/pr/pr-3024/new-hope-storybook/
web storybook: https://plasma.sberdevices.ru/pr/pr-3024/web-storybook/
sdds-bizcom storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-bizcom-storybook/
sdds-cs storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-cs-storybook/
sdds-dfa storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-dfa-storybook/
sdds-finai storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-finai-storybook/
sdds-insol storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-insol-storybook/
sdds-insol-next storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-insol-next-storybook/
sdds-netology storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-netology-storybook/
sdds-os storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-os-storybook/
sdds-platform-ai storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-platform-ai-storybook/
sdds-sbcom storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-sbcom-storybook/
sdds-scan storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-scan-storybook/
sdds-serv storybook: https://plasma.sberdevices.ru/pr/pr-3024/sdds-serv-storybook/

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.styles.ts`:
- Around line 28-29: Duration overrides incorrectly shadow configured animation
tokens and discard zero-valued Storybook settings. In LineSkeleton.styles.ts
lines 28-29 and 40-41, RectSkeleton.styles.ts lines 21-22 and 33-34, and
withSkeleton.styles.ts lines 11-12 and 18-19, check animation durations
explicitly against undefined and omit the CSS declaration when no override is
provided so configured tokens remain effective; in
utils/plasma-sb-utils/src/components/Skeleton/stories.tsx lines 118-124, replace
the falsy fallback with nullish coalescing so zero is preserved.

In `@utils/plasma-sb-utils/src/components/Skeleton/stories.tsx`:
- Around line 118-124: Update the animation options in the withSkeleton
configuration to preserve an explicit zero animationDuration by replacing the
truthiness fallback with nullish handling or direct propagation. Apply this
consistently in both branches of the visible conditional while retaining
undefined for absent values.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 17c2d3da-a3e6-4b7c-82f2-015fda89f788

📥 Commits

Reviewing files that changed from the base of the PR and between 54970bf and 85b68ed.

📒 Files selected for processing (25)
  • packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.styles.ts
  • packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.tsx
  • packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.types.ts
  • packages/plasma-new-hope/src/components/Skeleton/RectSkeleton/RectSkeleton.styles.ts
  • packages/plasma-new-hope/src/components/Skeleton/RectSkeleton/RectSkeleton.tsx
  • packages/plasma-new-hope/src/components/Skeleton/RectSkeleton/RectSkeleton.types.ts
  • packages/plasma-new-hope/src/components/Skeleton/Skeleton.template-doc.mdx
  • packages/plasma-new-hope/src/components/Skeleton/Skeleton.types.ts
  • packages/plasma-new-hope/src/components/Skeleton/TextSkeleton/TextSkeleton.tsx
  • packages/plasma-new-hope/src/components/Skeleton/hoc/withSkeleton.styles.ts
  • packages/plasma-new-hope/src/components/Skeleton/hoc/withSkeleton.tsx
  • packages/plasma-new-hope/src/components/Skeleton/hoc/withSkeleton.types.ts
  • utils/plasma-sb-utils/src/components/Skeleton/stories.tsx
  • website/plasma-b2c-docs/docs/components/Skeleton.mdx
  • website/plasma-giga-docs/docs/components/Skeleton.mdx
  • website/plasma-web-docs/docs/components/Skeleton.mdx
  • website/sdds-bizcom-docs/docs/components/Skeleton.mdx
  • website/sdds-cs-docs/docs/components/Skeleton.mdx
  • website/sdds-dfa-docs/docs/components/Skeleton.mdx
  • website/sdds-finai-docs/docs/components/Skeleton.mdx
  • website/sdds-insol-docs/docs/components/Skeleton.mdx
  • website/sdds-netology-docs/docs/components/Skeleton.mdx
  • website/sdds-platform-ai-docs/docs/components/Skeleton.mdx
  • website/sdds-sbcom-docs/docs/components/Skeleton.mdx
  • website/sdds-serv-docs/docs/components/Skeleton.mdx

Comment on lines +28 to +29
${tokens.shimmerDuration}: ${({ animationDuration }) =>
animationDuration ? `${animationDuration}ms` : `var(${tokens.shimmerDuration})`};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix duration fallback handling across all animation paths.

The style files assign each duration token to var(the same token) when no override exists. This shadows the configured token and forces the animation mixins to use hard-coded fallbacks. The Storybook adapter and style checks also discard 0. Use an explicit undefined check, omit the CSS declaration when no override exists, and use ?? in the stories.

  • packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.styles.ts#L28-L29: preserve the configured shimmer token.
  • packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.styles.ts#L40-L41: preserve the configured pulse token.
  • packages/plasma-new-hope/src/components/Skeleton/RectSkeleton/RectSkeleton.styles.ts#L21-L22: preserve the configured shimmer token.
  • packages/plasma-new-hope/src/components/Skeleton/RectSkeleton/RectSkeleton.styles.ts#L33-L34: preserve the configured pulse token.
  • packages/plasma-new-hope/src/components/Skeleton/hoc/withSkeleton.styles.ts#L11-L12: preserve the configured shimmer token.
  • packages/plasma-new-hope/src/components/Skeleton/hoc/withSkeleton.styles.ts#L18-L19: preserve the configured pulse token.
  • utils/plasma-sb-utils/src/components/Skeleton/stories.tsx#L118-L124: replace animationDuration || undefined with animationDuration ?? undefined.
Suggested pattern
- ${tokens.shimmerDuration}: ${({ animationDuration }) =>
-     animationDuration ? `${animationDuration}ms` : `var(${tokens.shimmerDuration})`};
+ ${({ animationDuration }) =>
+     animationDuration !== undefined
+         ? `${tokens.shimmerDuration}: ${animationDuration}ms;`
+         : ''}

- duration: animationDuration || undefined,
+ duration: animationDuration ?? undefined,
📍 Affects 4 files
  • packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.styles.ts#L28-L29 (this comment)
  • packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.styles.ts#L40-L41
  • packages/plasma-new-hope/src/components/Skeleton/RectSkeleton/RectSkeleton.styles.ts#L21-L22
  • packages/plasma-new-hope/src/components/Skeleton/RectSkeleton/RectSkeleton.styles.ts#L33-L34
  • packages/plasma-new-hope/src/components/Skeleton/hoc/withSkeleton.styles.ts#L11-L12
  • packages/plasma-new-hope/src/components/Skeleton/hoc/withSkeleton.styles.ts#L18-L19
  • utils/plasma-sb-utils/src/components/Skeleton/stories.tsx#L118-L124
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/plasma-new-hope/src/components/Skeleton/LineSkeleton/LineSkeleton.styles.ts`
around lines 28 - 29, Duration overrides incorrectly shadow configured animation
tokens and discard zero-valued Storybook settings. In LineSkeleton.styles.ts
lines 28-29 and 40-41, RectSkeleton.styles.ts lines 21-22 and 33-34, and
withSkeleton.styles.ts lines 11-12 and 18-19, check animation durations
explicitly against undefined and omit the CSS declaration when no override is
provided so configured tokens remain effective; in
utils/plasma-sb-utils/src/components/Skeleton/stories.tsx lines 118-124, replace
the falsy fallback with nullish coalescing so zero is preserved.

Comment on lines +118 to +124
duration: animationDuration || undefined,
}
: { type: 'shimmer' as const, customGradientColor: customGradientColor || undefined };
: {
type: 'shimmer' as const,
customGradientColor: customGradientColor || undefined,
duration: animationDuration || undefined,
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not discard an explicit zero duration.

animationDuration || undefined converts 0 to undefined before the value reaches withSkeleton. Use animationDuration ?? undefined or pass the value directly. If 0 is not supported, define and enforce a positive minimum instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@utils/plasma-sb-utils/src/components/Skeleton/stories.tsx` around lines 118 -
124, Update the animation options in the withSkeleton configuration to preserve
an explicit zero animationDuration by replacing the truthiness fallback with
nullish handling or direct propagation. Apply this consistently in both branches
of the visible conditional while retaining undefined for absent values.

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.

1 participant