mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
refactor(docs): use svelte:fragment where applicable
This commit is contained in:
parent
a6ec082e6f
commit
64879d9832
18 changed files with 58 additions and 62 deletions
|
@ -48,9 +48,9 @@
|
|||
expandedByDefault="{true}"
|
||||
bind:isSideNavOpen
|
||||
>
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
<span slot="platform" class="platform-name">
|
||||
Carbon Components Svelte
|
||||
|
|
|
@ -46,25 +46,25 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
|
|||
|
||||
<Accordion>
|
||||
<AccordionItem>
|
||||
<div slot="title">
|
||||
<svelte:fragment slot="title">
|
||||
<h5>Natural Language Classifier</h5>
|
||||
<div>AI / Machine Learning</div>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
|
||||
</p>
|
||||
</AccordionItem>
|
||||
<AccordionItem>
|
||||
<div slot="title">
|
||||
<svelte:fragment slot="title">
|
||||
<h5>Natural Language Understanding</h5>
|
||||
<div>AI / Machine Learning</div>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
<p>Analyze text to extract meta-data from content such as concepts, entities, emotion, relations, sentiment and more.</p>
|
||||
</AccordionItem>
|
||||
<AccordionItem>
|
||||
<div slot="title">
|
||||
<svelte:fragment slot="title">
|
||||
<h5>Language Translator</h5>
|
||||
<div>AI / Machine Learning</div>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
<p>Translate text, documents, and websites from one language to another. Create industry or region-specific translations via the service's customization capability.</p>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
|
|
|
@ -131,20 +131,20 @@ The slot name for the table header cells is `"cell-header"`.
|
|||
},
|
||||
]}"
|
||||
>
|
||||
<span slot="cell-header" let:header>
|
||||
<svelte:fragment slot="cell-header" let:header>
|
||||
{#if header.key === 'port'}
|
||||
{header.value} (network)
|
||||
{:else}
|
||||
{header.value}
|
||||
{/if}
|
||||
</span>
|
||||
<span slot="cell" let:row let:cell>
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="cell" let:row let:cell>
|
||||
{#if cell.key === 'rule' && cell.value === 'Round robin'}
|
||||
<Link icon={Launch16} href="https://en.wikipedia.org/wiki/Round-robin_DNS" target="_blank">{cell.value}</Link>
|
||||
{:else}
|
||||
{cell.value}
|
||||
{/if}
|
||||
</span>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
||||
### With title, description
|
||||
|
@ -1018,11 +1018,11 @@ In the following example, each row in the sortable data table has an overflow me
|
|||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<svelte:fragment slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
||||
### Non-expandable rows
|
||||
|
@ -1085,11 +1085,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
|||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<svelte:fragment slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
||||
### Expandable (short size)
|
||||
|
@ -1146,11 +1146,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
|||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<svelte:fragment slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
||||
### Expandable (tall size)
|
||||
|
@ -1207,11 +1207,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
|||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<svelte:fragment slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
||||
### Batch expansion
|
||||
|
@ -1268,11 +1268,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
|||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<svelte:fragment slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
||||
### Skeleton
|
||||
|
|
|
@ -16,12 +16,12 @@ This utility component uses the [Image API](https://developer.mozilla.org/en-US/
|
|||
Use the "loading" and "error" named slots to render an element when the image is loading or has an error.
|
||||
|
||||
<ImageLoader src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg">
|
||||
<div slot="loading">
|
||||
<svelte:fragment slot="loading">
|
||||
<InlineLoading />
|
||||
</div>
|
||||
<div slot="error">
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="error">
|
||||
An error occurred.
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</ImageLoader>
|
||||
|
||||
### With aspect ratio
|
||||
|
|
|
@ -25,9 +25,9 @@ source: Notification/InlineNotification.svelte
|
|||
### With actions
|
||||
|
||||
<InlineNotification kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours.">
|
||||
<div slot="actions">
|
||||
<svelte:fragment slot="actions">
|
||||
<NotificationActionButton>Learn more</NotificationActionButton>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</InlineNotification>
|
||||
|
||||
### Notification variants
|
||||
|
|
|
@ -13,11 +13,11 @@ components: ["Tabs", "Tab", "TabContent", "TabsSkeleton"]
|
|||
<Tab label="Tab label 1" />
|
||||
<Tab label="Tab label 2" />
|
||||
<Tab label="Tab label 3" />
|
||||
<div slot="content">
|
||||
<svelte:fragment slot="content">
|
||||
<TabContent>Content 1</TabContent>
|
||||
<TabContent>Content 2</TabContent>
|
||||
<TabContent>Content 3</TabContent>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Tabs>
|
||||
|
||||
### Auto width
|
||||
|
@ -30,11 +30,11 @@ Set `autoWidth` to `true` for tabs to have an automatically set width.
|
|||
<Tab label="Tab label 1" />
|
||||
<Tab label="Tab label 2" />
|
||||
<Tab label="Tab label 3" />
|
||||
<div slot="content">
|
||||
<svelte:fragment slot="content">
|
||||
<TabContent>Content 1</TabContent>
|
||||
<TabContent>Content 2</TabContent>
|
||||
<TabContent>Content 3</TabContent>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Tabs>
|
||||
|
||||
### Reactive example
|
||||
|
@ -47,11 +47,11 @@ Set `autoWidth` to `true` for tabs to have an automatically set width.
|
|||
<Tab label="Tab label 1" />
|
||||
<Tab label="Tab label 2" />
|
||||
<Tab label="Tab label 3" />
|
||||
<div slot="content">
|
||||
<svelte:fragment slot="content">
|
||||
<TabContent>Content 1</TabContent>
|
||||
<TabContent>Content 2</TabContent>
|
||||
<TabContent>Content 3</TabContent>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Tabs>
|
||||
|
||||
### Skeleton (default)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</script>
|
||||
|
||||
<DataTable sortable headers="{headers}" rows="{rows}">
|
||||
<span slot="cell" let:cell>
|
||||
<svelte:fragment slot="cell" let:cell>
|
||||
{#if cell.key === "overflow"}
|
||||
<OverflowMenu flipped>
|
||||
<OverflowMenuItem text="Restart" />
|
||||
|
@ -34,5 +34,5 @@
|
|||
<OverflowMenuItem danger text="Stop" />
|
||||
</OverflowMenu>
|
||||
{:else}{cell.value}{/if}
|
||||
</span>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
|
|
@ -60,9 +60,9 @@
|
|||
]}"
|
||||
rows="{rows}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<svelte:fragment slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</DataTable>
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
</Button>
|
||||
|
||||
<ImageLoader bind:this="{imageLoader}" bind:error fadeIn src="{src}">
|
||||
<div slot="error">
|
||||
<svelte:fragment slot="error">
|
||||
<Button kind="ghost" on:click="{() => imageLoader.loadImage(src)}">
|
||||
Error. Try again
|
||||
</Button>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</ImageLoader>
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
<Tab label="Tab label 1" />
|
||||
<Tab label="Tab label 2" />
|
||||
<Tab label="Tab label 3" />
|
||||
<div slot="content">
|
||||
<svelte:fragment slot="content">
|
||||
<TabContent>Content 1</TabContent>
|
||||
<TabContent>Content 2</TabContent>
|
||||
<TabContent>Content 3</TabContent>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Tabs>
|
||||
|
||||
<div>
|
||||
|
|
|
@ -15,10 +15,9 @@
|
|||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
|
||||
</svelte:fragment>
|
||||
<HeaderNav>
|
||||
<HeaderNavItem href="/" text="Link 1" />
|
||||
<HeaderNavItem href="/" text="Link 2" />
|
||||
|
|
|
@ -21,10 +21,9 @@
|
|||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
|
||||
</svelte:fragment>
|
||||
<HeaderNav>
|
||||
<HeaderNavItem href="/" text="Link 1" />
|
||||
<HeaderNavItem href="/" text="Link 2" />
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
|
||||
</svelte:fragment>
|
||||
<HeaderNav>
|
||||
<HeaderNavItem href="/" text="Link 1" />
|
||||
<HeaderNavItem href="/" text="Link 2" />
|
||||
|
|
|
@ -66,9 +66,9 @@
|
|||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte">
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
<HeaderUtilities>
|
||||
<HeaderSearch
|
||||
bind:ref
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
<HeaderUtilities>
|
||||
<HeaderAction bind:isOpen transition="{transitions[selected].value}">
|
||||
<HeaderPanelLinks>
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
<HeaderUtilities>
|
||||
<HeaderGlobalAction aria-label="Settings" icon="{SettingsAdjust20}" />
|
||||
<HeaderAction
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
platformName="Carbon Svelte"
|
||||
bind:isSideNavOpen
|
||||
>
|
||||
<div slot="skip-to-content">
|
||||
<svelte:fragment slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
|
||||
</svelte:fragment>
|
||||
<HeaderNav>
|
||||
<HeaderNavItem href="/" text="Link 1" />
|
||||
<HeaderNavItem href="/" text="Link 2" />
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
<Tab label="CSS StyleSheet" />
|
||||
<Tab label="CDN" />
|
||||
<Tab label="SCSS" />
|
||||
<div slot="content">
|
||||
<svelte:fragment slot="content">
|
||||
<TabContent>
|
||||
<p>
|
||||
This library ships with six pre-compiled CSS StyleSheets built
|
||||
|
@ -199,7 +199,7 @@
|
|||
for documentation.
|
||||
</p>
|
||||
</TabContent>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Tabs>
|
||||
</Column>
|
||||
</Row>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue