mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
Make UI Shell HeaderAction panel transition configurable (#419)
* fix(ui-shell): remove fly transition from hamburger menu * feat(header-action): make panel transition configurable * chore: rebuild types, docs * docs(ui-shell): document transition prop in Header app switcher example
This commit is contained in:
parent
1e72ea9942
commit
f4c940d5ee
31 changed files with 244 additions and 160 deletions
|
@ -16,10 +16,28 @@
|
|||
Grid,
|
||||
Row,
|
||||
Column,
|
||||
TileGroup,
|
||||
RadioTile,
|
||||
} from "carbon-components-svelte";
|
||||
import { expoIn } from "svelte/easing";
|
||||
|
||||
let isSideNavOpen = 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>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||
|
@ -27,7 +45,7 @@
|
|||
<SkipToContent />
|
||||
</div>
|
||||
<HeaderUtilities>
|
||||
<HeaderAction bind:isOpen>
|
||||
<HeaderAction bind:isOpen transition="{transitions[selected].value}">
|
||||
<HeaderPanelLinks>
|
||||
<HeaderPanelDivider>Switcher subject 1</HeaderPanelDivider>
|
||||
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
||||
|
@ -59,7 +77,16 @@
|
|||
<Grid>
|
||||
<Row>
|
||||
<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>
|
||||
</Row>
|
||||
</Grid>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue