diff --git a/README.md b/README.md index 7eab89f6..20f4cbd9 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ # carbon-components-svelte +> 🚧🚧🚧 UNDER CONSTRUCTION > Svelte implementation of the Carbon Design System -[🚧🚧🚧 UNDER CONSTRUCTION] - -## [Docs](https://ibm.github.io/carbon-components-svelte) +## [Storybook](https://ibm.github.io/carbon-components-svelte) ## Getting Started @@ -33,6 +32,8 @@ Currently, the following components are supported: - Link - ListItem - OrderedList +- Search +- SearchSkeleton - SkeletonText - Tag - TagSkeleton diff --git a/src/components/Search/Search.Skeleton.svelte b/src/components/Search/Search.Skeleton.svelte new file mode 100644 index 00000000..9a9e79dc --- /dev/null +++ b/src/components/Search/Search.Skeleton.svelte @@ -0,0 +1,15 @@ + + +
+ +
+
diff --git a/src/components/Search/Search.Story.svelte b/src/components/Search/Search.Story.svelte new file mode 100644 index 00000000..f50ab155 --- /dev/null +++ b/src/components/Search/Search.Story.svelte @@ -0,0 +1,19 @@ + + + +
+ {#if story === 'skeleton'} + + {:else} + + {/if} +
+
diff --git a/src/components/Search/Search.stories.js b/src/components/Search/Search.stories.js new file mode 100644 index 00000000..1800bfcb --- /dev/null +++ b/src/components/Search/Search.stories.js @@ -0,0 +1,27 @@ +import { withKnobs, select, boolean, text } from '@storybook/addon-knobs'; +import Component from './Search.Story.svelte'; + +export default { title: 'Search', decorators: [withKnobs] }; + +const sizes = { + 'Regular size (xl)': 'xl', + 'Large size (lg)': 'lg', + 'Small size (sm)': 'sm' +}; + +export const Default = () => ({ + Component, + props: { + size: select('Size (size)', sizes, 'xl'), + light: boolean('Light variant (light)', false), + name: text('Form item name (name)', ''), + labelText: text('Label text (labelText)', 'Search'), + closeButtonLabelText: text( + 'The label text for the close button (closeButtonLabelText)', + 'Clear search input' + ), + placeHolderText: text('Placeholder text (placeHolderText)', 'Search') + } +}); + +export const Skeleton = () => ({ Component, props: { story: 'skeleton' } }); diff --git a/src/components/Search/Search.svelte b/src/components/Search/Search.svelte new file mode 100644 index 00000000..f1f9baf0 --- /dev/null +++ b/src/components/Search/Search.svelte @@ -0,0 +1,65 @@ + + +
+ + + { + value = event.target.value; + }} /> + +
diff --git a/src/components/Search/index.js b/src/components/Search/index.js new file mode 100644 index 00000000..47fdbd17 --- /dev/null +++ b/src/components/Search/index.js @@ -0,0 +1,4 @@ +import Search from './Search.svelte'; + +export default Search; +export { default as SearchSkeleton } from './Search.Skeleton.svelte'; diff --git a/src/index.js b/src/index.js index 68192381..dcbe35d4 100644 --- a/src/index.js +++ b/src/index.js @@ -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 Search, { SearchSkeleton } from './components/Search'; import SkeletonText from './components/SkeletonText'; import Tag, { TagSkeleton } from './components/Tag'; import TextArea, { TextAreaSkeleton } from './components/TextArea'; @@ -39,6 +40,8 @@ export { Link, ListItem, OrderedList, + Search, + SearchSkeleton, SkeletonText, Tag, TagSkeleton,