-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from jedgar1mx/issue.49
Issue.49
- Loading branch information
Showing
45 changed files
with
370 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { create } from '@storybook/theming'; | ||
|
||
export default create({ | ||
base: 'light', | ||
|
||
colorPrimary: 'white', | ||
colorSecondary: '#004445', | ||
|
||
// UI | ||
appBg: 'white', | ||
appContentBg: '#e6e6e6', | ||
appBorderColor: '#004445', | ||
appBorderRadius: 6, | ||
|
||
// Typography | ||
fontBase: '"Montserrat", sans-serif', | ||
fontCode: '"Montserrat", monospace', | ||
|
||
// Text colors | ||
textColor: 'black', | ||
textInverseColor: 'white', | ||
textMutedColor: '#666666', | ||
|
||
// Toolbar default and active colors | ||
barTextColor: 'white', | ||
barSelectedColor: '#9FD5B3', | ||
barBg: '#004445', | ||
|
||
// Form colors | ||
inputBg: 'white', | ||
inputBorder: '#004445', | ||
inputTextColor: 'black', | ||
inputBorderRadius: 4, | ||
|
||
// Brand assets | ||
brandTitle: 'City of Detroit', | ||
brandUrl: 'https://detroitmi.gov', | ||
brandImage: './city-of-detroit-logo-1.png', | ||
brandTarget: '_self', | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,5 @@ module.exports = { | |
features: { | ||
interactionsDebugger: true, | ||
}, | ||
staticDirs: ['../public'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;800&display=swap" rel="stylesheet"> | ||
<link rel="shortcut icon" href="favicon.ico"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import CODTheme from './CODTheme'; | ||
import { addons } from '@storybook/addons'; | ||
|
||
addons.setConfig({ | ||
theme: CODTheme, | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Meta } from '@storybook/addon-docs'; | ||
|
||
<Meta title="COD UXDS/Setup" /> | ||
|
||
<h1 class="text-center">Setup</h1> | ||
|
||
## Installation | ||
|
||
COD Web Components make use of Stencil's automatic lazy loader which only loads components that are actually used on the page. | ||
|
||
### CDN | ||
|
||
Add the following inside your head tag | ||
|
||
```html | ||
<script src="https://www.unpkg.com/browse/[email protected]/build/assets/js/main.js"></script> | ||
<script src="https://www.unpkg.com/browse/[email protected]/build/assets/js/runtime.js"></script> | ||
<script src="https://www.unpkg.com/browse/[email protected]/build/assets/js/vendors.babel.js"></script> | ||
<script src="https://www.unpkg.com/browse/[email protected]/build/assets/js/vendors.bootstrap-icons.js"></script> | ||
``` | ||
|
||
### NPM | ||
|
||
`npm i @cityofdetroit/cod-design-system` | ||
|
||
### Yarn | ||
|
||
`yarn add @cityofdetroit/cod-design-system` | ||
|
||
```js | ||
import 'cod-design-system/src/components/atoms/Loader/cod-loader'; | ||
import 'cod-design-system/src/components/atoms/Button/cod-button'; | ||
``` | ||
|
||
## Setting Props | ||
|
||
### Basic Data | ||
|
||
For basic primitive types like `string`, `boolean`, `number`, set the attribute on the element: | ||
|
||
```js | ||
<cod-loader data-color="color-1"></cod-loader> | ||
``` | ||
|
||
## Using Slots | ||
|
||
Slots give you full control over the contents of a component. Some components may have multiple slots. | ||
|
||
> Web Component Concept: | ||
> Slotted content lives outside of the shadow DOM and as a result, you are free to style them however you want. | ||
|
||
```html | ||
<cod-breadcrumb> | ||
<li class="breadcrumb-item"><a href="#">Home</a></li> | ||
<li class="breadcrumb-item active" aria-current="page">Library</li> | ||
</cod-breadcrumb> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Meta } from '@storybook/addon-docs/blocks' | ||
|
||
<Meta title="COD UXDS/Customization" /> | ||
|
||
# Customization | ||
|
||
If you're new to using Web Components, you'll quickly notice that the traditional way of styling elements with CSS doesn't work with COD components. | ||
|
||
For example, this won't work: | ||
```html | ||
<cod-button style="background:red;">button</cod-button> | ||
``` | ||
|
||
This is a feature of the Shadow DOM--outside styles cannot be applied to content inside the Shadow DOM. Shadow DOM gives us a clean, native way | ||
of encapsulating styles and protects your applications from breaking changes. Luckily, the Shadow DOM API provides two solutions | ||
to this problem: CSS Custom Properties and CSS Shadow Parts. | ||
|
||
|
||
## Using CSS Custom Properties | ||
|
||
Each component API has a set of CSS Custom Properties defined. These are variables that you can set externally that will reflect inside the Shadow DOM. | ||
CSS Custom Properties are a lot like SASS variables, with one significant difference--they can be swapped at run time and do not require any build process. | ||
These CSS Custom Properties will usually be mapped to some CSS property (color, font-size, border-radius, etc). | ||
|
||
If you wanted to change the Button background, you could use the `--button-background-color` custom property like so: | ||
```css | ||
cod-button { | ||
--button-background-color: red; | ||
} | ||
``` | ||
|
||
## Using CSS Shadow Parts | ||
|
||
Because defining CSS Custom Properties for every possible CSS property is incredibly verbose and cumbersome, the recommended way for styling components is | ||
to make use of [CSS Shadow Parts](https://css-tricks.com/styling-in-the-shadow-dom-with-css-shadow-parts/). CSS Shadow Parts give you full control over | ||
the styling of a component's underlying Shadow DOM parts. | ||
|
||
If a component has any available Shadow Parts, they will be documented under their API section. | ||
|
||
To style a Shadow Part, use the [::part` pseudo-element](https://developer.mozilla.org/en-US/docs/Web/CSS/::part). | ||
For example, if you wanted to add some margin on the form label, you could style the `label` Shadow Part: | ||
```css | ||
cod-form-label::part(label) { | ||
margin-right: 1rem; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.