mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
add plain header UI Shell example (#459)
* chore: update codeowners * docs: clean-up README * docs(ui-shell): add plain header example * docs: revise down the number of components Although technically this library exports 150+ components, fewer than 50 are documented.
This commit is contained in:
parent
a9e63e0038
commit
6ee0bab0d9
6 changed files with 59 additions and 12 deletions
|
@ -1 +1,2 @@
|
|||
* @metonym
|
||||
* @metonym
|
||||
* @josefaidt
|
|
@ -1,5 +1,5 @@
|
|||
# Maintainers
|
||||
|
||||
Eric Liu - eric.young.liu@ibm.com
|
||||
[Eric Liu](https://github.com/metonym) - eric.young.liu@ibm.com
|
||||
|
||||
Josef Aidt - josef.aidt@gmail.com
|
||||
[Josef Aidt](https://github.com/josefaidt) - josef.aidt@gmail.com
|
||||
|
|
14
README.md
14
README.md
|
@ -19,10 +19,12 @@ The Carbon Svelte portfolio also includes:
|
|||
|
||||
<a href="https://www.vercel.com?utm_source=carbon-components-svelte&utm_campaign=oss" target="_blank"><img height="34px" src="./docs/public/powered-by-vercel.svg" alt="Deploys by Vercel" /></a>
|
||||
|
||||
The [documentation website](http://ibm.biz/carbon-svelte) contains live demos and examples. Other forms of documentation are auto-generated:
|
||||
The [documentation website](http://ibm.biz/carbon-svelte) contains live demos and examples.
|
||||
|
||||
Other forms of documentation are auto-generated:
|
||||
|
||||
- **[Component Index](COMPONENT_INDEX.md)**: Markdown file documenting component props, slots, and events
|
||||
- **[TypeScript definitions](types)**: Component TypeScript definitions
|
||||
- **[Component Index](COMPONENT_INDEX.md)**: Markdown file documenting component props, slots, and events
|
||||
- **[Component API](docs/src/COMPONENT_API.json)**: Component API metadata in JSON format
|
||||
|
||||
## Getting started
|
||||
|
@ -39,7 +41,7 @@ npm i -D carbon-components-svelte
|
|||
|
||||
The quickest way to get started is to customize a template from the [examples](examples/) folder.
|
||||
|
||||
Example set-ups demonstrate usage with popular application bundlers and frameworks. They feature a mix of Single-page Applications (SPA), Server-side rendering (SSR) and statically exported approaches.
|
||||
Example set-ups demonstrate usage with popular application bundlers and frameworks. They include a mix of client-side rendering (CSR) and server-side rendering (SSR) approaches.
|
||||
|
||||
- **[examples/rollup](examples/rollup/)**: SPA bundled using [Rollup](https://github.com/rollup/rollup)
|
||||
- **[examples/rollup-typescript](examples/rollup-typescript/)**: SPA bundled using [Rollup](https://github.com/rollup/rollup) with TypeScript support
|
||||
|
@ -91,11 +93,7 @@ Import components from `carbon-components-svelte` in the `script` tag of your Sv
|
|||
- **g100.css**: Gray 100 theme (dark)
|
||||
- **all.css**: All themes (White, Gray 10, Gray 90, Gray 100) using CSS variables
|
||||
|
||||
Each StyleSheet is [generated](scripts/build-css.js) from the flagship [carbon-components](https://github.com/carbon-design-system/carbon/tree/master/packages/components) library.
|
||||
|
||||
The [examples](examples/) use `all.css` for dynamic theming through CSS variables.
|
||||
|
||||
Because the CSS is precompiled, it includes all Carbon design styles. One method to optimize the CSS is to ship only the CSS that is used. This can be accomplished using [PurgeCSS](https://github.com/FullHuman/purgecss) with a Carbon style extractor (WIP).
|
||||
Each StyleSheet is [generated](scripts/build-css.js) from the flagship [carbon-components](https://github.com/carbon-design-system/carbon/tree/master/packages/components) library..
|
||||
|
||||
#### Usage
|
||||
|
||||
|
|
|
@ -26,8 +26,14 @@ components: ["Header",
|
|||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
||||
### Header
|
||||
|
||||
<FileSource src="/framed/UIShell/Header" />
|
||||
|
||||
### Header with side navigation
|
||||
|
||||
The hamburger menu will automatically be rendered if the `SideNav` component is used.
|
||||
|
||||
<FileSource src="/framed/UIShell/HeaderNav" />
|
||||
|
||||
### Header with app switcher
|
||||
|
|
42
docs/src/pages/framed/UIShell/Header.svelte
Normal file
42
docs/src/pages/framed/UIShell/Header.svelte
Normal file
|
@ -0,0 +1,42 @@
|
|||
<script>
|
||||
import {
|
||||
Header,
|
||||
HeaderNav,
|
||||
HeaderNavItem,
|
||||
HeaderNavMenu,
|
||||
SkipToContent,
|
||||
Content,
|
||||
Grid,
|
||||
Row,
|
||||
Column,
|
||||
} from "carbon-components-svelte";
|
||||
|
||||
let isSideNavOpen = false;
|
||||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||
<div slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
|
||||
<HeaderNav>
|
||||
<HeaderNavItem href="/" text="Link 1" />
|
||||
<HeaderNavItem href="/" text="Link 2" />
|
||||
<HeaderNavItem href="/" text="Link 3" />
|
||||
<HeaderNavMenu text="Menu">
|
||||
<HeaderNavItem href="/" text="Link 1" />
|
||||
<HeaderNavItem href="/" text="Link 2" />
|
||||
<HeaderNavItem href="/" text="Link 3" />
|
||||
</HeaderNavMenu>
|
||||
</HeaderNav>
|
||||
</Header>
|
||||
|
||||
<Content>
|
||||
<Grid>
|
||||
<Row>
|
||||
<Column>
|
||||
<h1>Welcome</h1>
|
||||
</Column>
|
||||
</Row>
|
||||
</Grid>
|
||||
</Content>
|
|
@ -85,7 +85,7 @@
|
|||
borderRight
|
||||
borderBottom
|
||||
title="Carbon Components Svelte"
|
||||
subtitle="100+ components"
|
||||
subtitle="50+ components"
|
||||
target="_blank"
|
||||
href="https://github.com/IBM/carbon-components-svelte"
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue