From 13bd64e5c9d5de84e578d947760b295177b8c54f Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sun, 18 Jul 2021 05:39:35 -0700 Subject: [PATCH] Improve docs (#756) * docs: remove Theme from new components * docs: add styling instructions * docs: add styling instructions * docs: update copy --- README.md | 19 ++- docs/src/components/Footer.svelte | 2 +- docs/src/pages/_layout.svelte | 2 +- docs/src/pages/components/Button.svx | 8 +- docs/src/pages/components/OrderedList.svx | 4 +- docs/src/pages/components/UnorderedList.svx | 2 +- docs/src/pages/index.svelte | 143 ++++++++++++++++++-- 7 files changed, 157 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 278dfde9..17967c57 100644 --- a/README.md +++ b/README.md @@ -13,27 +13,34 @@ The Carbon Svelte portfolio also includes: - **[Carbon Icons Svelte](https://github.com/IBM/carbon-icons-svelte)**: 6000+ Carbon icons as Svelte components - **[Carbon Pictograms Svelte](https://github.com/IBM/carbon-pictograms-svelte)**: 700+ Carbon pictograms as Svelte components -- **[Carbon Charts Svelte](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/svelte)**: 20 chart types, powered by d3 +- **[Carbon Charts Svelte](https://github.com/carbon-design-system/carbon-charts/tree/master/packages/svelte)**: 20+ charts, powered by d3 +- **[Carbon Preprocess Svelte](https://github.com/IBM/carbon-preprocess-svelte)**: Collection of Svelte preprocessors for Carbon ## [Documentation](http://ibm.biz/carbon-svelte) -Deploys by Vercel +Deploys by Vercel The [documentation website](http://ibm.biz/carbon-svelte) contains live demos and examples. Other forms of documentation are auto-generated: - **[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 +- **[Component Index](COMPONENT_INDEX.md)**: Component API in Markdown format +- **[Component API](docs/src/COMPONENT_API.json)**: Component API in JSON format -## Getting started +## Installation Install `carbon-components-svelte` as a development dependency. +**Yarn** + ```sh yarn add -D carbon-components-svelte -# OR +``` + +**NPM** + +```sh npm i -D carbon-components-svelte ``` diff --git a/docs/src/components/Footer.svelte b/docs/src/components/Footer.svelte index b2b8e391..4acac22c 100644 --- a/docs/src/components/Footer.svelte +++ b/docs/src/components/Footer.svelte @@ -11,7 +11,7 @@ target="_blank" > Deploys by Vercel diff --git a/docs/src/pages/_layout.svelte b/docs/src/pages/_layout.svelte index b5743fde..2324a182 100644 --- a/docs/src/pages/_layout.svelte +++ b/docs/src/pages/_layout.svelte @@ -20,7 +20,7 @@ import Footer from "../components/Footer.svelte"; const deprecated = ["ToggleSmall", "Icon"]; - const new_components = ["Theme"]; + const new_components = []; let isOpen = false; let isSideNavOpen = true; diff --git a/docs/src/pages/components/Button.svx b/docs/src/pages/components/Button.svx index 2b2f0f45..c0b06446 100644 --- a/docs/src/pages/components/Button.svx +++ b/docs/src/pages/components/Button.svx @@ -1,5 +1,5 @@ @@ -32,15 +56,14 @@ > Svelte - component library that implements the Carbon Design System, an + component library that implements the - open source design system - - by IBM. + Carbon Design System + , an open source design system by IBM.

Design systems facilitate design and development through reuse, @@ -50,23 +73,117 @@ -

Install

-

Installing with yarn:

+

Installation

+

+ Install + carbon-components-svelte + as a development dependency in your project. +

+

Using Yarn:

-

Using npm:

+

Using NPM:

+ + +

Styling

+

+ Before importing components, you will need to first apply Carbon + component styles. The Carbon Design System supports five themes (2 + light, 3 dark). +

+ + {#each ["white", "g10", "g80", "g90", "g100"] as value} + + {/each} + +
+
+ + + + + + + +
+ +

+ This library ships with six pre-compiled CSS StyleSheets built + from + + carbon-components + . +

+ + +

+ +

+
+
+
+ +

+ An alternative to loading styles is to link an external + StyleSheet from a Content Delivery Networks (CDN) like + + unpkg.com + . +

+

+ This is best suited for rapid prototyping or if your set-up does + not use a CSS loader. +

+ + +

+ +

+
+
+
+ +

+ The most performant method to load styles is to import SCSS + directly from carbon-components. Although it + requires more set up, you can reduce the size of the bundle CSS + by importing individual component styles instead of a + pre-compiled CSS StyleSheet. +

+

+ Refer to the official Carbon guide on SASS for documentation. +

+
+
+
+
+
+

Portfolio

- The broader Carbon Svelte effort includes libraries for icons, - pictograms, and data visualization. + The Carbon Svelte portfolio includes packages for icons, pictograms, + and data visualization.

@@ -106,7 +223,7 @@ @@ -124,3 +241,9 @@
+ +