mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26:36 +00:00
docs(ui-shell): document transition prop in Header app switcher example
This commit is contained in:
parent
75d7d36884
commit
3dec75c088
2 changed files with 33 additions and 2 deletions
|
@ -32,6 +32,10 @@ components: ["Header",
|
||||||
|
|
||||||
### Header with app switcher
|
### Header with app switcher
|
||||||
|
|
||||||
|
The `HeaderAction` component uses the [transition:slide API](https://svelte.dev/docs#slide); you can customize the transition duration, delay, and easing with the `transition` prop.
|
||||||
|
|
||||||
|
You can disable the `transition` by setting it to `false`.
|
||||||
|
|
||||||
<FileSource src="/framed/UIShell/HeaderSwitcher" />
|
<FileSource src="/framed/UIShell/HeaderSwitcher" />
|
||||||
|
|
||||||
### Header with global search
|
### Header with global search
|
||||||
|
|
|
@ -16,10 +16,28 @@
|
||||||
Grid,
|
Grid,
|
||||||
Row,
|
Row,
|
||||||
Column,
|
Column,
|
||||||
|
TileGroup,
|
||||||
|
RadioTile,
|
||||||
} from "carbon-components-svelte";
|
} from "carbon-components-svelte";
|
||||||
|
import { expoIn } from "svelte/easing";
|
||||||
|
|
||||||
let isSideNavOpen = false;
|
let isSideNavOpen = false;
|
||||||
let isOpen = false;
|
let isOpen = false;
|
||||||
|
let selected = "0";
|
||||||
|
let transitions = {
|
||||||
|
"0": {
|
||||||
|
text: "Default (duration: 200ms)",
|
||||||
|
value: { duration: 200 },
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
text: "Custom (duration: 600ms, delay: 50ms, easing: expoIn)",
|
||||||
|
value: { duration: 600, delay: 50, easing: expoIn },
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
text: "Disabled",
|
||||||
|
value: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||||
|
@ -27,7 +45,7 @@
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</div>
|
||||||
<HeaderUtilities>
|
<HeaderUtilities>
|
||||||
<HeaderAction bind:isOpen>
|
<HeaderAction bind:isOpen transition="{transitions[selected].value}">
|
||||||
<HeaderPanelLinks>
|
<HeaderPanelLinks>
|
||||||
<HeaderPanelDivider>Switcher subject 1</HeaderPanelDivider>
|
<HeaderPanelDivider>Switcher subject 1</HeaderPanelDivider>
|
||||||
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
||||||
|
@ -59,7 +77,16 @@
|
||||||
<Grid>
|
<Grid>
|
||||||
<Row>
|
<Row>
|
||||||
<Column>
|
<Column>
|
||||||
<h1>Welcome</h1>
|
<h1>HeaderSwitcher</h1>
|
||||||
|
<p>
|
||||||
|
Select a transition option below and click on the App Switcher icon in
|
||||||
|
the top right.
|
||||||
|
</p>
|
||||||
|
<TileGroup legend="App switcher transitions" bind:selected>
|
||||||
|
{#each Object.keys(transitions) as key}
|
||||||
|
<RadioTile value="{key}">{transitions[key].text}</RadioTile>
|
||||||
|
{/each}
|
||||||
|
</TileGroup>
|
||||||
</Column>
|
</Column>
|
||||||
</Row>
|
</Row>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue