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:
Eric Liu 2020-11-26 17:14:07 -08:00 committed by GitHub
commit f4c940d5ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 244 additions and 160 deletions

View file

@ -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>