mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
chore(examples): add webpack example set-up
The set-up uses the pre-compiled CSS.
This commit is contained in:
parent
26f383360f
commit
99f1dd2c34
11 changed files with 5664 additions and 0 deletions
92
examples/webpack/src/App.svelte
Normal file
92
examples/webpack/src/App.svelte
Normal file
|
@ -0,0 +1,92 @@
|
|||
<script>
|
||||
import {
|
||||
Content,
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
Grid,
|
||||
Row,
|
||||
Column,
|
||||
Tabs,
|
||||
TabContent,
|
||||
Tab,
|
||||
Select,
|
||||
SelectItem,
|
||||
} from "carbon-components-svelte";
|
||||
import Header from "./components/Header.svelte";
|
||||
import Theme from "./components/Theme.svelte";
|
||||
|
||||
let theme = "white";
|
||||
</script>
|
||||
|
||||
<Theme theme="{theme}">
|
||||
<Header />
|
||||
<Content style="background: none; padding: 1rem">
|
||||
<Grid>
|
||||
<Row>
|
||||
<Column lg="{16}">
|
||||
<Breadcrumb noTrailingSlash aria-label="Page navigation">
|
||||
<BreadcrumbItem href="/">Getting started</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
<h1 style="margin-bottom: 1.5rem">Design & build with Carbon</h1>
|
||||
</Column>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<Column noGutter>
|
||||
<Tabs aria-label="Tab navigation">
|
||||
<Tab label="About" />
|
||||
<Tab label="Design" />
|
||||
<Tab label="Develop" />
|
||||
<div slot="content" class="tabbed-content">
|
||||
<Grid as fullWidth let:props>
|
||||
<TabContent {...props}>
|
||||
<Row>
|
||||
<Column md="{4}" lg="{7}">
|
||||
<Select
|
||||
labelText="Carbon theme"
|
||||
bind:selected="{theme}"
|
||||
style="margin-bottom: 1rem">
|
||||
<SelectItem value="white" text="White" />
|
||||
<SelectItem value="g10" text="Gray 10" />
|
||||
<SelectItem value="g90" text="Gray 90" />
|
||||
<SelectItem value="g100" text="Gray 100" />
|
||||
</Select>
|
||||
<p>
|
||||
Carbon is IBM’s open-source design system for digital
|
||||
products and experiences. With the IBM Design Language
|
||||
as its foundation, the system consists of working code,
|
||||
design tools and resources, human interface guidelines,
|
||||
and a vibrant community of contributors.
|
||||
</p>
|
||||
</Column>
|
||||
</Row>
|
||||
</TabContent>
|
||||
<TabContent {...props}>
|
||||
<Row>
|
||||
<Column md="{4}" lg="{7}">
|
||||
<p>
|
||||
Rapidly build beautiful and accessible experiences. The
|
||||
Carbon kit contains all resources you need to get
|
||||
started.
|
||||
</p>
|
||||
</Column>
|
||||
</Row>
|
||||
</TabContent>
|
||||
<TabContent {...props}>
|
||||
<Row>
|
||||
<Column md="{4}" lg="{7}">
|
||||
<p>
|
||||
Carbon provides styles and components in Vanilla, React,
|
||||
Angular, Vue and Svelte for anyone building on the web.
|
||||
</p>
|
||||
</Column>
|
||||
</Row>
|
||||
</TabContent>
|
||||
</Grid>
|
||||
</div>
|
||||
</Tabs>
|
||||
</Column>
|
||||
</Row>
|
||||
</Grid>
|
||||
</Content>
|
||||
</Theme>
|
22
examples/webpack/src/components/Header.svelte
Normal file
22
examples/webpack/src/components/Header.svelte
Normal file
|
@ -0,0 +1,22 @@
|
|||
<script>
|
||||
import {
|
||||
SkipToContent,
|
||||
Header,
|
||||
HeaderUtilities,
|
||||
HeaderGlobalAction,
|
||||
} from "carbon-components-svelte";
|
||||
import Notification20 from "carbon-icons-svelte/lib/Notification20";
|
||||
import UserAvatar20 from "carbon-icons-svelte/lib/UserAvatar20";
|
||||
import AppSwitcher20 from "carbon-icons-svelte/lib/AppSwitcher20";
|
||||
</script>
|
||||
|
||||
<Header company="IBM" platformName="Carbon Components Svelte" href="/">
|
||||
<div slot="skip-to-content">
|
||||
<SkipToContent />
|
||||
</div>
|
||||
<HeaderUtilities>
|
||||
<HeaderGlobalAction aria-label="Notifications" icon="{Notification20}" />
|
||||
<HeaderGlobalAction aria-label="User Avatar" icon="{UserAvatar20}" />
|
||||
<HeaderGlobalAction aria-label="App Switcher" icon="{AppSwitcher20}" />
|
||||
</HeaderUtilities>
|
||||
</Header>
|
7
examples/webpack/src/components/Theme.svelte
Normal file
7
examples/webpack/src/components/Theme.svelte
Normal file
|
@ -0,0 +1,7 @@
|
|||
<script>
|
||||
export let theme = "white";
|
||||
|
||||
$: document.documentElement.setAttribute("theme", theme);
|
||||
</script>
|
||||
|
||||
<slot />
|
6
examples/webpack/src/index.js
Normal file
6
examples/webpack/src/index.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import "carbon-components-svelte/css/all.css";
|
||||
import App from "./App.svelte";
|
||||
|
||||
const app = new App({ target: document.body });
|
||||
|
||||
export default app;
|
Loading…
Add table
Add a link
Reference in a new issue