Skip to content

Commit

Permalink
chore(storybook): cleanup and codesandbox cdn info (#10875)
Browse files Browse the repository at this point in the history
* chore(storybook): cleanup and codesandbox cdn info

* fix(doc): carbon-cdn-style-helper

* chore(codesandbox): use parcel instead of webpack for basic csb

---------

Co-authored-by: Anna Wen <[email protected]>
  • Loading branch information
ariellalgilmore and annawen1 committed Aug 24, 2023
1 parent b66df02 commit 6f9040b
Show file tree
Hide file tree
Showing 52 changed files with 478 additions and 131 deletions.
74 changes: 12 additions & 62 deletions packages/carbon-web-components/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,68 +131,18 @@ export const parameters = {
},
},
options: {
storySort: (storyA, storyB) => {
// By default, sort by the story "kind". The "kind" refers to the
// top-level title of the story, either through Component Story Format
// with the default export, or the `storiesOf('kind', module)` format
if (storyA[1].kind !== storyB[1].kind) {
return storyA[1].kind.localeCompare(storyB[1].kind);
}

const idA = storyA[0];
const idB = storyB[0];

// To story the stories, we first build up a list of matches based on
// keywords. Each keyword has a specific weight that will be used to
// determine order later on.
const UNKNOWN_KEYWORD = 3;
const keywords = new Map([
['welcome', 0],
['default', 1],
['usage', 2],
['playground', 4],
['development', 5],
['deprecated', 6],
['unstable', 7],
]);
const matches = new Map();

// We use this list of keywords to determine a collection of matches. By
// default, we will look for the greatest valued matched
for (const [keyword, weight] of keywords) {
// If we already have a match for a given id that is greater than the
// specific keyword we're looking for, break early
if (matches.get(idA) > weight || matches.get(idB) > weight) {
break;
}

// If we don't have a match already for either id, we check to see if
// the id includes the keyword and assigns the relevant weight, if so
if (idA.includes(keyword)) {
matches.set(idA, weight);
}

if (idB.includes(keyword)) {
matches.set(idB, weight);
}
}

// If we have matches for either id, then we will compare the ids based on
// the weight assigned to the matching keyword
if (matches.size > 0) {
const weightA = matches.get(idA) ?? UNKNOWN_KEYWORD;
const weightB = matches.get(idB) ?? UNKNOWN_KEYWORD;
// If we have the same weight for the ids, then we should compare them
// using locale compare instead of by weight
if (weightA === weightB) {
return idA.localeCompare(idB);
}
return weightA - weightB;
}

// By default, if we have no matches we'll do a locale compare between the
// two ids
return idA.localeCompare(idB);
storySort: {
order: [
'Introduction',
[
'Welcome',
'Custom styles',
'Carbon CDN style helpers',
'Form Participation',
],
'Components',
'Layout',
],
},
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Description, Meta } from '@storybook/addon-docs/blocks';
import readme from './carbon-cdn-style-helpers.md';

<Meta title="Introduction/Carbon CDN style helpers" />

<Description markdown={readme} />
328 changes: 328 additions & 0 deletions packages/carbon-web-components/docs/carbon-cdn-style-helpers.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions packages/carbon-web-components/examples/codesandbox/basic/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"presets": [
[
"@babel/preset-env",
{
"modules": false,
"targets": [
"last 1 version",
"Firefox ESR",
"not opera > 0",
"not op_mini > 0",
"not op_mob > 0",
"not android > 0",
"not edge > 0",
"not ie > 0",
"not ie_mob > 0"
]
}
]
],
"plugins": [["@babel/plugin-transform-runtime", { "version": "7.3.0" }]]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-accordion:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-breadcrumb:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-button:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-checkbox:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-code-snippet:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-combo-box:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-combo-box:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-copy-buton:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
<head>
<title>@carbon/ibmdotcom-web-components example</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css" />

<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-data-table:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-date-picker:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-dropdown:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-file-uploader:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-icon-button:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-icon-button:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-inline-loading:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-form-item:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
.example-layer-test-component {
padding: 1rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-link:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-ordered-list:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-loading:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-modal:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-multi-select:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-inline-notification:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-number-input:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8" />
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>
<link rel="stylesheet" href="src/styles.scss" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-overflow-menu:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />

<style>
/* Suppress custom element until styles are loaded */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-pagination:not(:defined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<meta charset="UTF-8"/>
<link rel="stylesheet"
href="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/plex.css"/>

<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/grid.css" />
<link rel="stylesheet" href="https://1.www.s81c.com/common/carbon/web-components/tag/v2/latest/themes.css" />
<style>
/* Suppress custom element until styles are loaded */
cds-progress-bar:not(:defined) {
Expand Down
Loading

0 comments on commit 6f9040b

Please sign in to comment.