Skip to content

Commit 5eea58b

Browse files
authored
chore(storybook): link to swc on docs pages (#3356)
1 parent 38adbe1 commit 5eea58b

File tree

63 files changed

+191
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+191
-65
lines changed

.storybook/assets/base.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* stylelint-disable selector-class-pattern -- Targeting pre-defined Storybook classes */
2+
13
/*!
24
* Copyright 2024 Adobe. All rights reserved.
35
*
@@ -11,7 +13,6 @@
1113
* governing permissions and limitations under the License.
1214
*/
1315

14-
/* stylelint-disable selector-class-pattern */
1516
body {
1617
--spectrum-font-family: var(--spectrum-sans-font-family-stack);
1718
--spectrum-font-style: var(--spectrum-default-font-style);
@@ -67,4 +68,5 @@ svg:has(symbol):not(:has(use)) {
6768
story view), due to Storybook's inline style that sets overflow: auto */
6869
overflow: visible !important;
6970
}
71+
7072
/* stylelint-enable selector-class-pattern */

.storybook/assets/images/wc_logo.svg

Lines changed: 28 additions & 0 deletions
Loading

.storybook/assets/index.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* stylelint-disable selector-class-pattern -- Targeting pre-defined Storybook classes */
2+
13
/*!
24
* Copyright 2024 Adobe. All rights reserved.
35
*
@@ -11,7 +13,6 @@
1113
* governing permissions and limitations under the License.
1214
*/
1315

14-
/* stylelint-disable selector-class-pattern */
1516
body {
1617
--spectrum-font-family-ar: myriad-arabic, adobe-clean, "Source Sans Pro", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, ubuntu, "Trebuchet MS", "Lucida Grande", sans-serif;
1718
--spectrum-font-family-he: myriad-hebrew, adobe-clean, "Source Sans Pro", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, ubuntu, "Trebuchet MS", "Lucida Grande", sans-serif;
@@ -66,6 +67,15 @@ nav .spectrum-Site-logo {
6667
padding: 20px !important;
6768
}
6869

70+
/* Hide that first divider line in the top navigation */
71+
div.sb-bar > div > div > span:first-child {
72+
display: none;
73+
}
74+
75+
div.sb-bar > div > div > div > button {
76+
background-color: white !important;
77+
}
78+
6979
.docblock-argstable-body tr td {
7080
letter-spacing: unset;
7181
font-size: 11px;
@@ -118,4 +128,5 @@ select:focus,
118128
border-color: rgb(2, 101, 220) !important;
119129
box-shadow: rgb(2, 101, 220) 0 0 0 1px inset !important;
120130
}
131+
121132
/* stylelint-enable selector-class-pattern */

.storybook/blocks/ComponentDetails.jsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import React, { useEffect, useState } from "react";
55
import AdobeSVG from "../assets/images/adobe_logo.svg?raw";
66
import GitHubSVG from "../assets/images/github_logo.svg?raw";
77
import NpmSVG from "../assets/images/npm_logo.svg?raw";
8+
import WCSVG from "../assets/images/wc_logo.svg?raw";
89
import { Body, Code, Heading } from "./Typography.jsx";
910
import { fetchToken } from "./utilities.js";
1011

@@ -121,6 +122,7 @@ export const ResourceLink = styled.a`
121122
border-color: rgb(230, 230, 230);
122123
overflow: hidden;
123124
color: rgb(0, 0, 0);
125+
background-color: rgba(255 255 255 / 80%);
124126
125127
&:hover {
126128
border-color: rgb(213, 213, 213);
@@ -314,6 +316,8 @@ const fetchLogo = (brand) => {
314316
return GitHubSVG;
315317
case "Adobe":
316318
return AdobeSVG;
319+
case "WC":
320+
return WCSVG;
317321
}
318322

319323
return;
@@ -361,23 +365,35 @@ export const ResourceLinkContent = ({ heading, alt, logo, href }) => {
361365
export const ResourceListDetails = ({ packageName, spectrumData = [], rootClassName, isDeprecated }) => {
362366
if (!packageName) return;
363367

364-
let href;
368+
let swc, href;
365369

366370
for(let i = 0; i < spectrumData?.length; i++) {
367-
if (spectrumData[i]?.guidelines && spectrumData[i]?.rootClass === rootClassName) {
371+
const thisComponent = !spectrumData[i]?.rootClass || spectrumData[i]?.rootClass === rootClassName;
372+
if (spectrumData[i]?.guidelines && thisComponent) {
368373
href = spectrumData[i]?.guidelines;
369374
}
375+
376+
if (spectrumData[i]?.swc && thisComponent) {
377+
swc = spectrumData[i]?.swc;
378+
}
370379
}
371380

372381
return (
373382
<ResourceSection className="sb-unstyled">
374383
{href ?
375384
<ResourceLinkContent
376385
className="doc-block-resource-cards"
377-
heading="View guidelines"
386+
heading="Design guidelines"
378387
alt="Spectrum website"
379388
logo="Adobe"
380389
href={href}/> : ""}
390+
{swc ?
391+
<ResourceLinkContent
392+
className="doc-block-resource-cards"
393+
heading="Web components"
394+
alt="Spectrum web components"
395+
logo="WC"
396+
href={swc}/> : ""}
381397
<ResourceLinkContent
382398
className="doc-block-resource-cards"
383399
heading="View package"

components/accordion/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"spectrum": [
5353
{
5454
"guidelines": "https://spectrum-contributions.corp.adobe.com/page/accordion-beta",
55-
"rootClass": "spectrum-Accordion"
55+
"rootClass": "spectrum-Accordion",
56+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/accordion/"
5657
}
5758
]
5859
}

components/actionbar/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"spectrum": [
5959
{
6060
"guidelines": "https://spectrum.adobe.com/page/action-bar",
61-
"rootClass": "spectrum-ActionBar"
61+
"rootClass": "spectrum-ActionBar",
62+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/action-bar/"
6263
}
6364
]
6465
}

components/actionbutton/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"spectrum": [
5959
{
6060
"guidelines": "https://spectrum.adobe.com/page/action-button",
61-
"rootClass": "spectrum-ActionButton"
61+
"rootClass": "spectrum-ActionButton",
62+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/action-button/"
6263
}
6364
]
6465
}

components/actiongroup/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"spectrum": [
5454
{
5555
"guidelines": "https://spectrum.adobe.com/page/action-group",
56-
"rootClass": "spectrum-ActionGroup"
56+
"rootClass": "spectrum-ActionGroup",
57+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/action-group/"
5758
}
5859
]
5960
}

components/actionmenu/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,10 @@
5454
],
5555
"publishConfig": {
5656
"access": "public"
57-
}
57+
},
58+
"spectrum": [
59+
{
60+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/action-menu/"
61+
}
62+
]
5863
}

components/alertbanner/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
"spectrum": [
6464
{
6565
"guidelines": "https://spectrum.adobe.com/page/alert-banner",
66-
"rootClass": "spectrum-AlertBanner"
66+
"rootClass": "spectrum-AlertBanner",
67+
"swc": "https://opensource.adobe.com/spectrum-web-components/components/alert-banner/"
6768
}
6869
]
6970
}

0 commit comments

Comments
 (0)