mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 03:01:25 +00:00
parent
a5e98de4a7
commit
925bfba548
11 changed files with 7242 additions and 0 deletions
50
palimpsest/src/App.svelte
Normal file
50
palimpsest/src/App.svelte
Normal file
|
@ -0,0 +1,50 @@
|
|||
<script>
|
||||
import { Router, Link, Route } from 'svelte-routing';
|
||||
import copy from 'clipboard-copy';
|
||||
import { Search, Link as CarbonLink, CodeSnippet } from 'carbon-components-svelte';
|
||||
import ThemePicker from './components/ThemePicker.svelte';
|
||||
|
||||
let value = '';
|
||||
|
||||
$: code = `
|
||||
search component "${value}"
|
||||
`.trim();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
height: 2.5rem;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<Router>
|
||||
<nav>
|
||||
<Link to="/">Home</Link>
|
||||
<Link to="about">About</Link>
|
||||
</nav>
|
||||
<div>
|
||||
<Route path="about" component={ThemePicker} />
|
||||
<Route path="/">Home</Route>
|
||||
</div>
|
||||
</Router>
|
||||
|
||||
<header>
|
||||
<CarbonLink href="https://github.com/IBM/carbon-components-svelte">GitHub</CarbonLink>
|
||||
<div>
|
||||
<ThemePicker />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div style="width: 16rem">
|
||||
<Search id="search-components" labelText="Components" small bind:value />
|
||||
</div>
|
||||
|
||||
<CodeSnippet
|
||||
on:click={() => {
|
||||
copy(code);
|
||||
}}
|
||||
{code} />
|
16
palimpsest/src/components/ThemePicker.svelte
Normal file
16
palimpsest/src/components/ThemePicker.svelte
Normal file
|
@ -0,0 +1,16 @@
|
|||
<script>
|
||||
import { Select, SelectItem } from 'carbon-components-svelte';
|
||||
|
||||
let selected = 'white';
|
||||
|
||||
$: {
|
||||
document.documentElement.setAttribute('carbon-theme', selected);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Select inline labelText="Select Carbon Theme" bind:selected>
|
||||
<SelectItem value="white" text="White (light)" />
|
||||
<SelectItem value="g10" text="Gray 10 (light)" />
|
||||
<SelectItem value="g90" text="Gray 90 (dark)" />
|
||||
<SelectItem value="g100" text="Gray 100 (dark)" />
|
||||
</Select>
|
6
palimpsest/src/index.js
Normal file
6
palimpsest/src/index.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
import './style.scss';
|
||||
import App from './App.svelte';
|
||||
|
||||
const app = new App({ target: document.body });
|
||||
|
||||
export default app;
|
41
palimpsest/src/style.scss
Normal file
41
palimpsest/src/style.scss
Normal file
|
@ -0,0 +1,41 @@
|
|||
$feature-flags: (
|
||||
enable-css-custom-properties: true
|
||||
);
|
||||
|
||||
@import 'carbon-components/scss/globals/scss/_css--helpers.scss';
|
||||
@import 'carbon-components/scss/globals/scss/vendor/@carbon/elements/scss/themes/_mixins.scss';
|
||||
|
||||
:root {
|
||||
@include carbon--theme($carbon--theme--white, true);
|
||||
}
|
||||
|
||||
:root[carbon-theme='g10'] {
|
||||
@include carbon--theme($carbon--theme--g10, true);
|
||||
}
|
||||
|
||||
:root[carbon-theme='g90'] {
|
||||
@include carbon--theme($carbon--theme--g90, true);
|
||||
}
|
||||
|
||||
:root[carbon-theme='g100'] {
|
||||
@include carbon--theme($carbon--theme--g100, true);
|
||||
}
|
||||
|
||||
$css--font-face: true;
|
||||
$css--helpers: true;
|
||||
$css--body: true;
|
||||
$css--use-layer: true;
|
||||
$css--reset: true;
|
||||
$css--default-type: true;
|
||||
$css--plex: true;
|
||||
|
||||
@import 'carbon-components/scss/globals/scss/_css--reset.scss';
|
||||
@import 'carbon-components/scss/globals/scss/_css--font-face.scss';
|
||||
@import 'carbon-components/scss/globals/scss/_css--helpers.scss';
|
||||
@import 'carbon-components/scss/globals/scss/_css--body.scss';
|
||||
@import 'carbon-components/scss/globals/grid/_grid.scss';
|
||||
|
||||
@import 'carbon-components/scss/components/search/_search.scss';
|
||||
@import 'carbon-components/scss/components/select/_select.scss';
|
||||
@import 'carbon-components/scss/components/copy-button/_copy-button.scss';
|
||||
@import 'carbon-components/scss/components/code-snippet/_code-snippet.scss';
|
Loading…
Add table
Add a link
Reference in a new issue