-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ add viewports, chromatic and modes (#2)
* ✅ add viewports, chromatic and modes * 🎨 add container queries to repository.js * 🎨 add container queries!
- Loading branch information
Showing
15 changed files
with
363 additions
and
60 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,24 @@ | ||
# Workflow name | ||
name: 'Chromatic' | ||
|
||
# Event for the workflow | ||
on: push | ||
|
||
# List of jobs | ||
jobs: | ||
chromatic-deployment: | ||
# Operating System | ||
runs-on: ubuntu-latest | ||
# Job steps | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install dependencies | ||
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g. yarn, npm, pnpm | ||
run: npm i | ||
# 👇 Adds Chromatic as a step in the workflow | ||
- name: Publish to Chromatic | ||
uses: chromaui/action@v1 | ||
# Chromatic GitHub Action options | ||
with: | ||
# 👇 Chromatic projectToken, refer to the manage page to obtain it. | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} |
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,60 @@ | ||
/** | ||
* @fileoverview Storybook modes used for testing in Chromatic | ||
* @see https://www.chromatic.com/docs/modes | ||
*/ | ||
|
||
import { customViewports } from './viewports'; | ||
import { primerThemes } from './primer-preview'; | ||
|
||
const defaultThemes = ['light', 'dark']; | ||
|
||
export const defaultModes = {}; | ||
export const githubModes = {}; | ||
|
||
for (const key of Object.keys(customViewports)) { | ||
defaultModes[key] = { | ||
viewport: key, | ||
}; | ||
githubModes[key] = { | ||
viewport: key, | ||
}; | ||
for (const theme of defaultThemes) { | ||
defaultModes[`${theme} ${key}`] = { | ||
viewport: key, | ||
theme: theme, | ||
}; | ||
}; | ||
for (const theme of primerThemes) { | ||
githubModes[`primer ${theme.value} ${key}`] = { | ||
viewport: key, | ||
theme: theme.value, | ||
}; | ||
}; | ||
}; | ||
|
||
export const allModes = { | ||
mobile: { | ||
viewport: 'small', | ||
}, | ||
desktop: { | ||
viewport: 'large', | ||
}, | ||
dark: { | ||
backgrounds: 'dark', | ||
theme: 'dark', | ||
}, | ||
light: { | ||
backgrounds: 'light', | ||
theme: 'light', | ||
}, | ||
'dark desktop': { | ||
backgrounds: 'dark', | ||
theme: 'dark', | ||
viewport: 'large', | ||
}, | ||
'light mobile': { | ||
backgrounds: 'light', | ||
theme: 'light', | ||
viewport: 'small', | ||
}, | ||
}; |
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,3 @@ | ||
.sb-show-main { | ||
margin: 0; | ||
} |
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,32 @@ | ||
// .storybook/preview.js | ||
|
||
import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport'; | ||
|
||
export const customViewports = { | ||
containerMin1: { | ||
name: 'ContainerMin1: 200px', | ||
styles: { | ||
width: '200px', | ||
height: '100%', | ||
}, | ||
}, | ||
containerMin2: { | ||
name: 'ContainerMin2: 300px', | ||
styles: { | ||
width: '300px', | ||
height: '100%', | ||
}, | ||
}, | ||
containerMin3: { | ||
name: 'ContainerMin3: 400px', | ||
styles: { | ||
width: '400px', | ||
height: '100%', | ||
}, | ||
}, | ||
}; | ||
|
||
export const viewports ={ | ||
...MINIMAL_VIEWPORTS, | ||
...customViewports, | ||
}; |
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 @@ | ||
Settings add missing support for css container query syntax | ||
|
||
@see https://github.com/wileycoyote78/custom-css/ | ||
@see https://stackoverflow.com/questions/76125833/container-type-property-and-container-rule-are-not-recognized-by-vs-code/76125894#76125894 |
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,88 @@ | ||
{ | ||
"version": 1.1, | ||
"$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/master/docs/customData.schema.json", | ||
"atDirectives": [ | ||
{ | ||
"name": "@container", | ||
"description": { | ||
"kind": "markdown", | ||
"value": "The **@container** CSS at-rule is a conditional group rule that applies styles to a containment context." | ||
}, | ||
"references": [ | ||
{ | ||
"name": "MDN reference", | ||
"url": "https://developer.mozilla.org/en-US/docs/Web/CSS/@container" | ||
} | ||
], | ||
"browsers": [ | ||
"E105", | ||
"FF110", | ||
"C105", | ||
"S16.0", | ||
"O91" | ||
] | ||
} | ||
], | ||
"properties": [ | ||
{ | ||
"name": "container-type", | ||
"description": { | ||
"kind": "markdown", | ||
"value": "The **container-type** CSS property is used to define the type of containment used in a container query." | ||
}, | ||
"references": [ | ||
{ | ||
"name": "MDN reference", | ||
"url": "https://developer.mozilla.org/docs/Web/CSS/container-type" | ||
} | ||
], | ||
"browsers": [ | ||
"E105", | ||
"FF110", | ||
"C105", | ||
"S16.0", | ||
"O91" | ||
] | ||
}, | ||
{ | ||
"name": "container-name", | ||
"description": { | ||
"kind": "markdown", | ||
"value": "The **container-name** CSS property specifies a list of query container names used by the **@container** at rule in a container query." | ||
}, | ||
"references": [ | ||
{ | ||
"name": "MDN reference", | ||
"url": "https://developer.mozilla.org/en-US/docs/Web/CSS/container-name" | ||
} | ||
], | ||
"browsers": [ | ||
"E105", | ||
"FF110", | ||
"C105", | ||
"S16.0", | ||
"O91" | ||
] | ||
}, | ||
{ | ||
"name": "container", | ||
"description": { | ||
"kind": "markdown", | ||
"value": "The **container** shorthand CSS property establishes the element as a query container and specifies the name or name for the containment used in a container query." | ||
}, | ||
"references": [ | ||
{ | ||
"name": "MDN reference", | ||
"url": "https://developer.mozilla.org/en-US/docs/Web/CSS/container" | ||
} | ||
], | ||
"browsers": [ | ||
"E105", | ||
"FF110", | ||
"C105", | ||
"S16.0", | ||
"O91" | ||
] | ||
} | ||
] | ||
} |
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 @@ | ||
{ | ||
"css.customData": [ | ||
"./.vscode/custom-css.json" | ||
], | ||
"prettier.enable": true, | ||
} |
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.