feat(components): add SkeletonPlaceholder

This commit is contained in:
Eric Liu 2019-12-15 14:42:23 -08:00
commit f3e5da73db
6 changed files with 61 additions and 0 deletions

View file

@ -33,6 +33,7 @@ Currently, the following components are supported:
- Link
- ListItem
- OrderedList
- SkeletonPlaceholder
- SkeletonText
- Tag
- TagSkeleton

View file

@ -0,0 +1,27 @@
<script>
import Layout from '../../internal/ui/Layout.svelte';
import SkeletonPlaceholder from './SkeletonPlaceholder.svelte';
</script>
<style>
:global(.my--skeleton__placeholder--small) {
height: 100px;
width: 100px;
}
:global(.my--skeleton__placeholder--medium) {
height: 150px;
width: 150px;
}
:global(.my--skeleton__placeholder--large) {
height: 250px;
width: 250px;
}
</style>
<Layout>
<div style="height: 250px; width: 250px;">
<SkeletonPlaceholder {...$$props} />
</div>
</Layout>

View file

@ -0,0 +1,17 @@
import { withKnobs, select } from '@storybook/addon-knobs';
import Component from './SkeletonPlaceholder.Story.svelte';
export default { title: 'Skeleton Placeholder', decorators: [withKnobs] };
const classes = {
'my--skeleton__placeholder--small': 'my--skeleton__placeholder--small',
'my--skeleton__placeholder--medium': 'my--skeleton__placeholder--medium',
'my--skeleton__placeholder--large': 'my--skeleton__placeholder--large'
};
export const Default = () => ({
Component,
props: {
class: select('Classes with different sizes', classes)
}
});

View file

@ -0,0 +1,11 @@
<script>
let className = undefined;
export { className as class };
export let props = {};
import { cx } from '../../lib';
const _class = cx('--skeleton__placeholder', className);
</script>
<div {...props} class={_class} />

View file

@ -0,0 +1,3 @@
import SkeletonPlaceholder from './SkeletonPlaceholder.svelte';
export default SkeletonPlaceholder;

View file

@ -10,6 +10,7 @@ import Loading from './components/Loading';
import Link from './components/Link';
import ListItem from './components/ListItem';
import OrderedList from './components/OrderedList';
import SkeletonPlaceholder from './components/SkeletonPlaceholder';
import SkeletonText from './components/SkeletonText';
import Tag, { TagSkeleton } from './components/Tag';
import TextArea, { TextAreaSkeleton } from './components/TextArea';
@ -39,6 +40,7 @@ export {
Link,
ListItem,
OrderedList,
SkeletonPlaceholder,
SkeletonText,
Tag,
TagSkeleton,