-
Notifications
You must be signed in to change notification settings - Fork 10
feat(Skeleton): Add Skeleton component #481
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d76bd76
feat: add Skeleton component with styles, stories, and tests
MaxLee-dev 691145a
feat: add Skeleton component documentation, examples, and styles
MaxLee-dev c1c57bd
feat: add korean docs and description
MaxLee-dev 7b19992
feat: add screenshots for Skeleton component tests across multiple br…
MaxLee-dev fa7e05e
chore: add changeset for Skeleton component
MaxLee-dev 147d36b
style: format SkeletonComposition component for better readability
MaxLee-dev c5d775d
fix: update border radius for square shape and refine shimmer animati…
MaxLee-dev 197687e
Merge branch 'main' of https://github.com/goorm-dev/vapor-ui into add…
MaxLee-dev e6fd9e3
Merge branch 'main' of https://github.com/goorm-dev/vapor-ui into add…
MaxLee-dev 5ef7c56
feat(skeleton): update skeleton components to use $css prop for styling
MaxLee-dev dd7239e
feat(icons): add IntelliSenseEventIcon alignment check
MaxLee-dev 71233c3
feat(skeleton): update description for the new Skeleton component
MaxLee-dev 97b2512
feat(skeleton): update SkeletonComposition to use $css prop for borde…
MaxLee-dev 165926e
feat(skeleton): update Skeleton stories to use $css prop for styling
MaxLee-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@vapor-ui/core': minor | ||
| --- | ||
|
|
||
| Add Skeleton component | ||
|
|
||
| You can see more details about the Skeleton component in the [Skeleton documentation](https://vapor-ui.goorm.io/docs/components/skeleton). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| --- | ||
| title: 'Skeleton' | ||
| site_name: 'Skeleton - Vapor Core' | ||
| description: '콘텐츠가 로딩 중임을 나타내는 플레이스홀더 요소입니다.' | ||
| --- | ||
|
|
||
| <Demo name="skeleton/default-skeleton"> | ||
| ```json doc-gen:file | ||
| { | ||
| "file": "./src/components/demo/examples/skeleton/default-skeleton.tsx", | ||
| "codeblock": true | ||
| } | ||
| ``` | ||
| </Demo> | ||
|
|
||
| ## Property | ||
|
|
||
| --- | ||
|
|
||
| ### Shape | ||
|
|
||
| Skeleton의 모서리 둥글기를 설정합니다. | ||
|
|
||
| <Demo name="skeleton/skeleton-shape"> | ||
| ```json doc-gen:file | ||
| { | ||
| "file": "./src/components/demo/examples/skeleton/skeleton-shape.tsx", | ||
| "codeblock": true | ||
| } | ||
| ``` | ||
| </Demo> | ||
|
|
||
| ### Animation | ||
|
|
||
| Skeleton의 애니메이션 스타일을 설정합니다. | ||
|
|
||
| <Demo name="skeleton/skeleton-animation"> | ||
| ```json doc-gen:file | ||
| { | ||
| "file": "./src/components/demo/examples/skeleton/skeleton-animation.tsx", | ||
| "codeblock": true | ||
| } | ||
| ``` | ||
| </Demo> | ||
|
|
||
| ### Size | ||
|
|
||
| Skeleton의 높이를 설정합니다. | ||
|
|
||
| <Demo name="skeleton/skeleton-size"> | ||
| ```json doc-gen:file | ||
| { | ||
| "file": "./src/components/demo/examples/skeleton/skeleton-size.tsx", | ||
| "codeblock": true | ||
| } | ||
| ``` | ||
| </Demo> | ||
|
|
||
| ## Examples | ||
|
|
||
| --- | ||
|
|
||
| ### Profile Card | ||
|
|
||
| 여러 Skeleton 요소를 조합하여 프로필 카드 플레이스홀더를 구성하는 예제입니다. | ||
|
|
||
| <Demo name="skeleton/skeleton-composition"> | ||
| ```json doc-gen:file | ||
| { | ||
| "file": "./src/components/demo/examples/skeleton/skeleton-composition.tsx", | ||
| "codeblock": true | ||
| } | ||
| ``` | ||
| </Demo> | ||
|
|
||
| ## Props Table | ||
|
|
||
| --- | ||
|
|
||
| ### Skeleton | ||
|
|
||
| <ComponentPropsTable componentName="skeleton" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "name": "Skeleton", | ||
| "displayName": "Skeleton", | ||
| "description": "콘텐츠가 로딩 중임을 나타내는 placeholder 요소입니다. `<div>` 요소를 렌더링합니다.", | ||
| "props": [ | ||
| { | ||
| "name": "animation", | ||
| "type": ["none", "shimmer", "pulse"], | ||
| "required": false, | ||
| "description": "skeleton의 애니메이션 스타일을 제어합니다.\n\n- `shimmer`: 빛이 스치는 효과\n- `pulse`: 깜빡이는 효과\n- `none`: 애니메이션 비활성화", | ||
| "defaultValue": "shimmer" | ||
| }, | ||
| { | ||
| "name": "shape", | ||
| "type": ["square", "rounded"], | ||
| "required": false, | ||
| "description": "skeleton의 테두리 반경을 제어합니다.", | ||
| "defaultValue": "rounded" | ||
| }, | ||
| { | ||
| "name": "size", | ||
| "type": ["sm", "md", "lg", "xl"], | ||
| "required": false, | ||
| "description": "skeleton의 높이를 제어합니다.", | ||
| "defaultValue": "md" | ||
| }, | ||
| { | ||
| "name": "render", | ||
| "type": ["ReactElement", "(props: HTMLProps) => ReactElement"], | ||
| "required": false, | ||
| "description": "component의 HTML element를 다른 태그로 교체하거나 다른 component와 조합할 수 있습니다.\n\nReactElement 또는 렌더링할 요소를 반환하는 함수를 받습니다." | ||
| } | ||
| ], | ||
| "defaultElement": "div" | ||
| } |
5 changes: 5 additions & 0 deletions
5
apps/website/src/components/demo/examples/skeleton/default-skeleton.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { Skeleton } from '@vapor-ui/core'; | ||
|
|
||
| export default function DefaultSkeleton() { | ||
| return <Skeleton width="200px" />; | ||
| } |
26 changes: 26 additions & 0 deletions
26
apps/website/src/components/demo/examples/skeleton/skeleton-animation.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { HStack, Skeleton, Text, VStack } from '@vapor-ui/core'; | ||
|
|
||
| export default function SkeletonAnimation() { | ||
| return ( | ||
| <VStack gap="$150"> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="80px" typography="body3" foreground="hint-100"> | ||
| shimmer | ||
| </Text> | ||
| <Skeleton animation="shimmer" /> | ||
| </HStack> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="80px" typography="body3" foreground="hint-100"> | ||
| pulse | ||
| </Text> | ||
| <Skeleton animation="pulse" /> | ||
| </HStack> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="80px" typography="body3" foreground="hint-100"> | ||
| none | ||
| </Text> | ||
| <Skeleton animation="none" /> | ||
| </HStack> | ||
| </VStack> | ||
| ); | ||
| } |
26 changes: 26 additions & 0 deletions
26
apps/website/src/components/demo/examples/skeleton/skeleton-composition.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { Box, HStack, Skeleton, VStack } from '@vapor-ui/core'; | ||
|
|
||
| export default function SkeletonComposition() { | ||
| return ( | ||
| <Box | ||
| padding="$200" | ||
| border="1px solid" | ||
| borderColor="$normal" | ||
| borderRadius="$100" | ||
| maxWidth="320px" | ||
| > | ||
| <HStack gap="$150" alignItems="center"> | ||
| <Skeleton shape="rounded" width="40px" height="40px" /> | ||
| <VStack gap="$075"> | ||
| <Skeleton shape="rounded" size="sm" width="120px" /> | ||
| <Skeleton shape="rounded" size="sm" width="80px" /> | ||
| </VStack> | ||
| </HStack> | ||
| <VStack gap="$075" marginTop="$200"> | ||
| <Skeleton shape="square" size="sm" /> | ||
| <Skeleton shape="square" size="sm" width="90%" /> | ||
| <Skeleton shape="square" size="sm" width="75%" /> | ||
| </VStack> | ||
| </Box> | ||
| ); | ||
| } |
20 changes: 20 additions & 0 deletions
20
apps/website/src/components/demo/examples/skeleton/skeleton-shape.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { HStack, Skeleton, Text, VStack } from '@vapor-ui/core'; | ||
|
|
||
| export default function SkeletonShape() { | ||
| return ( | ||
| <VStack gap="$150"> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="80px" typography="body3" foreground="hint-100"> | ||
| rounded | ||
| </Text> | ||
| <Skeleton shape="rounded" width="200px" /> | ||
| </HStack> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="80px" typography="body3" foreground="hint-100"> | ||
| square | ||
| </Text> | ||
| <Skeleton shape="square" width="200px" /> | ||
| </HStack> | ||
| </VStack> | ||
| ); | ||
| } |
32 changes: 32 additions & 0 deletions
32
apps/website/src/components/demo/examples/skeleton/skeleton-size.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { HStack, Skeleton, Text, VStack } from '@vapor-ui/core'; | ||
|
|
||
| export default function SkeletonSize() { | ||
| return ( | ||
| <VStack gap="$150"> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="40px" typography="body3" foreground="hint-100"> | ||
| sm | ||
| </Text> | ||
| <Skeleton size="sm" /> | ||
| </HStack> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="40px" typography="body3" foreground="hint-100"> | ||
| md | ||
| </Text> | ||
| <Skeleton size="md" /> | ||
| </HStack> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="40px" typography="body3" foreground="hint-100"> | ||
| lg | ||
| </Text> | ||
| <Skeleton size="lg" /> | ||
| </HStack> | ||
| <HStack gap="$200" alignItems="center"> | ||
| <Text width="40px" typography="body3" foreground="hint-100"> | ||
| xl | ||
| </Text> | ||
| <Skeleton size="xl" /> | ||
| </HStack> | ||
| </VStack> | ||
| ); | ||
| } |
Binary file added
BIN
+18.3 KB
packages/core/__tests__/screenshots/skeleton--test-bed-1-chrome-darwin-.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.3 KB
packages/core/__tests__/screenshots/skeleton--test-bed-1-edge-darwin-.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.2 KB
packages/core/__tests__/screenshots/skeleton--test-bed-1-firefox-darwin-.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.7 KB
packages/core/__tests__/screenshots/skeleton--test-bed-1-safari-darwin-.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './skeleton'; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import { keyframes } from '@vanilla-extract/css'; | ||
| import type { RecipeVariants } from '@vanilla-extract/recipes'; | ||
| import { recipe } from '@vanilla-extract/recipes'; | ||
|
|
||
| import { layerStyle } from '~/styles/mixins/layer-style.css'; | ||
| import { vars } from '~/styles/themes.css'; | ||
|
|
||
| const shimmerKeyframes = keyframes({ | ||
| to: { backgroundPosition: 'right -6.25rem top 0' }, | ||
| }); | ||
|
|
||
| const pulseKeyframes = keyframes({ | ||
| '0%, 100%': { opacity: 1 }, | ||
| '50%': { opacity: 0.5 }, | ||
| }); | ||
|
|
||
| /** | ||
| * Style variants for the Skeleton component. | ||
| */ | ||
| export const root = recipe({ | ||
| base: layerStyle('components', { | ||
| display: 'block', | ||
| overflow: 'hidden', | ||
| width: '100%', | ||
| backgroundColor: vars.color.gray['100'], | ||
|
|
||
| '@media': { | ||
| '(prefers-reduced-motion: reduce)': { | ||
| animation: 'none', | ||
| }, | ||
| }, | ||
| }), | ||
|
|
||
| defaultVariants: { shape: 'rounded', size: 'md', animation: 'shimmer' }, | ||
| variants: { | ||
| /** | ||
| * Controls the border radius of the skeleton. | ||
| */ | ||
| shape: { | ||
| rounded: layerStyle('components', { | ||
| borderRadius: '9999px', | ||
| }), | ||
| square: layerStyle('components', { | ||
| borderRadius: vars.size.borderRadius['300'], | ||
| }), | ||
| }, | ||
|
|
||
| /** | ||
| * Controls the height of the skeleton. | ||
| */ | ||
| size: { | ||
| sm: layerStyle('components', { height: vars.size.dimension['200'] }), | ||
| md: layerStyle('components', { height: vars.size.dimension['300'] }), | ||
| lg: layerStyle('components', { height: vars.size.dimension['400'] }), | ||
| xl: layerStyle('components', { height: vars.size.dimension['500'] }), | ||
| }, | ||
|
|
||
| /** | ||
| * Controls the animation style of the skeleton. | ||
| */ | ||
| animation: { | ||
| shimmer: layerStyle('components', { | ||
| backgroundImage: `linear-gradient(90deg, ${vars.color.gray['100']}, ${vars.color.gray['050']}, ${vars.color.gray['100']})`, | ||
| backgroundPosition: 'left -6.25rem top 0', | ||
| backgroundSize: '6.25rem 100%', | ||
| backgroundRepeat: 'no-repeat', | ||
| animation: `${shimmerKeyframes} 1s ease-in-out infinite`, | ||
| }), | ||
| pulse: layerStyle('components', { | ||
| animation: `${pulseKeyframes} 1.2s ease-in-out infinite`, | ||
| }), | ||
| none: layerStyle('components', { | ||
| animation: 'none', | ||
| }), | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export type SkeletonVariants = NonNullable<RecipeVariants<typeof root>>; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.