-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5d193b
commit 40bb0c3
Showing
10 changed files
with
119 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# CHANGELOG | ||
|
||
## v2.0.73 | ||
|
||
- Add `Skeleton` component | ||
|
||
## v2.0.72 | ||
|
||
- Add `Panel` component | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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,10 @@ | ||
import { Canvas, ArgTypes, PRIMARY_STORY } from '@storybook/addon-docs'; | ||
import { Primary } from './Skeleton.stories'; | ||
|
||
# Skeleton | ||
|
||
<Canvas of={Primary} /> | ||
|
||
## Props | ||
|
||
<ArgTypes story={PRIMARY_STORY} /> |
This file contains 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,37 @@ | ||
import { Meta, StoryFn } from '@storybook/vue3'; | ||
import mdx from './Skeleton.mdx'; | ||
// @ts-ignore No types from Vue file | ||
import Skeleton from './Skeleton.vue'; | ||
|
||
const meta: Meta<typeof Skeleton> = { | ||
title: 'Components/Skeleton', | ||
component: Skeleton, | ||
parameters: { | ||
docs: { | ||
page: mdx | ||
} | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template: StoryFn = (args, { argTypes }) => ({ | ||
components: { Skeleton }, | ||
setup: () => ({ args }), | ||
template: ` | ||
<div style="width: 500px;"> | ||
<Skeleton v-bind="args"> | ||
<template #header>Metadata</template> | ||
<template #default> | ||
<ul> | ||
<li>City: Chicago</li> | ||
<li>State: Illinois</li> | ||
<li>Country: United States</li> | ||
</ul> | ||
</template> | ||
</Panel> | ||
</div> | ||
` | ||
}); | ||
|
||
export const Primary = Template.bind({}); |
This file contains 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,44 @@ | ||
<template> | ||
<Skeleton | ||
:class="`uic-skeleton color-${color}`" | ||
data-testid="uic-skeleton" | ||
:height | ||
:width | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import Skeleton from 'primevue/skeleton'; | ||
import { SkeletonColor } from './constants'; | ||
withDefaults( | ||
defineProps<{ | ||
color?: SkeletonColor; | ||
width?: string; | ||
height?: string; | ||
}>(), | ||
{ | ||
color: SkeletonColor.NEUTRAL, | ||
width: undefined, | ||
height: undefined | ||
} | ||
); | ||
</script> | ||
|
||
<style> | ||
.uic-skeleton { | ||
@apply overflow-hidden; | ||
@apply animate-pulse; | ||
@apply rounded-lg; | ||
&.color-error { | ||
@apply bg-error; | ||
} | ||
&.color-neutral { | ||
@apply bg-gray-200; | ||
} | ||
&.color-success { | ||
@apply bg-success; | ||
} | ||
} | ||
</style> |
This file contains 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,10 @@ | ||
import '@testing-library/jest-dom'; | ||
import { render } from '@testing-library/vue'; | ||
import Skeleton from '../Skeleton.vue'; | ||
|
||
describe('Skeleton', () => { | ||
it('renders', () => { | ||
const { getByTestId } = render(Skeleton); | ||
expect(getByTestId('uic-skeleton')).toBeVisible(); | ||
}); | ||
}); |
This file contains 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,8 @@ | ||
import { Color } from '@/types'; | ||
|
||
export const SkeletonColor = { | ||
ERROR: Color.ERROR, | ||
NEUTRAL: Color.NEUTRAL, | ||
SUCCESS: Color.SUCCESS | ||
} as const; | ||
export type SkeletonColor = (typeof SkeletonColor)[keyof typeof SkeletonColor]; |
This file contains 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,2 @@ | ||
export * from './constants'; | ||
export { default as Skeleton } from './Skeleton.vue'; |
This file contains 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