Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ResourceListDetails doc block #3129

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

marissahuysentruyt
Copy link
Collaborator

@marissahuysentruyt marissahuysentruyt commented Sep 18, 2024

Description

In the effort to bring as much of the docs site into Storybook, this PR creates a new <ResourceListDetails /> doc block component. It should replicate this resource section of the docs site:

Screenshot 2024-09-18 at 4 19 12 PM

<ResourceListDetails /> should render each of the resource link cards (<ResourceLinkContent />) if the link exists. To do so, we are pulling data from each component's package.json. A few things should happen with that data:

  • we can get the package name, which corresponds to the package on NPM
  • using that package name, we can programmatically create links to the component's package on NPM and its place in the repo (navigating to the component's README)

There was also a need for a sub-component, <ResourceLinkContent />, to hold the individual resource's content (the SVG icon, the "title" and "subtitle"). There are several styled components as well, mainly used as containers/wrappers, that made up the basis of the styles for the two main components.

Additionally, a few helper functions were created to map a particular SVG to the corresponding card based on its linkTypes prop value, and to convert some subtitle/description text based on the the linkType as well.

Component package.json updates

  1. Adding a componentGuidelinesName key to each component's package.json (set to the component's page path on the Spectrum Guidelines site) gives us the ability to also create a link to the Spectrum Guidelines site. For the majority of components, this single addition is sufficient.
  2. In cases where Spectrum Guidelines do not exist for a component (like accordion or dial), if documentation could be found on the Spectrum Contributions site, the componentBetaName key was added, set to the component's page path on that site instead.
  3. For cases where no guidelines could be found on either of the sites mentioned above, the componentGuidelinesName key was left as an empty string. This allows us to just not render that specific card.

Uncovered issues

The switch and progress bar do not render some of the doc blocks. Neither renders the ComponentDetails or this new ResourceListDetails block. Although both render TaggedReleases, I believe there's issues with the data coming back from NPM for those two components. There is one tag found, at 0.1.0, and that link goes to a deprecated NPM package called undefined.js.

More details and screenshots regarding this issue can be found in the thread of this message.

Jira/Specs

CSS-772

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

It is necessary to be on the VPN in order to verify and access some of the Spectrum Contributions links.

  • Pull down the branch and run locally with yarn start.
  • Verify each component renders 2-3 new resource cards by visiting their docs storybook pages. You may run into errors (i.e. Quota exceeded.), so there are tips below ⬇️ to resolve that.
  • Some components do not have a Spectrum Guidelines page, but have a page on the Spectrum Contributions site. Verify the following components render all 3 resources cards, and their guidelines card navigates to the proper Spectrum Contributions page.
    • accordion
    • asset card
    • calendar
    • coach indicator
    • date picker
    • dial
    • dialog ("standard dialog")
    • drop zone
    • floating action button
    • illustrated message
    • logic button
    • miller columns
    • opacity checkerboard
    • pagination ("pagination list")
    • steplist
    • stepper ("number field")
    • tag group
    • thumbnail
    • well ("wells")
  • Verify that components with no guidelines only render their GitHub and NPM resource cards.
    • action menu
    • asset
    • asset list
    • clear button
    • color handle
    • drop indicator
    • field group
    • infield button
    • modal
    • picker button
    • split view
    • underlay
  • Some components are "nested" within other components, and both packages are derived from a single package.json.
  • Visit the form docs page. Ensure no guidelines resource card is rendered.
  • Visit the [meter}(http://localhost:8080/?path=/docs/components-meter--docs) docs page. Ensure that a guidelines resource card is rendered and navigates to the meter specific Spectrum Guidelines page.
  • As noted above, switch and progress bar may not render the ResourceListDetails component or ComponentDetails. It will have incorrect information the TaggedReleases block.

In your code editor:

  • With the project running, open the .storybook/blocks/ComponentDetails.jsx file
  • In the ResourceListDetails component, change the linkType prop to any value you'd like. (in this example, I used "sparkles")
Screenshot 2024-09-19 at 12 16 07 PM
  • The project should not render, and if you look in the browser, you should see an error message, similar to the one below, catching the invalid linkType value:
Screenshot 2024-09-18 at 1 04 17 PM
  • Revert that change and ensure the project renders as normal.
  • Visit any component docs page (like http://localhost:8080/?path=/docs/components-help-text--docs)
  • Find that component's package.json (/components/your-component/package.json)
  • At the bottom of the package.json, you should see either the componentGuidelinesName key, or componentBetaName. Test 3 scenarios:
  1. If the key had a value, change the value to an empty string.
    • Back in the browser, the guidelines resource card should not render.
Screenshot 2024-09-19 at 12 19 34 PM
  1. If the key had a value, change it to something else.
    • Back in the browser, the guidelines resource card should render. When you click on that card, you should navigate to a URL path with your new value.
  2. If the key was an empty string, set the value to something new.
    • Back in the browser, the guidelines resource card should render. When you click on that card, you should navigate to a URL path with your new value.
  • Verify that form and meter are defined as nestedComponentName key in the field-label and progress-bar package.json files respectively.
  • Check that the cards flow responsively when the window resizes.
Screenshot 2024-09-19 at 1 31 18 PM Screenshot 2024-09-19 at 1 31 09 PM

Things to note

  • Some components don't have a 1:1 match when comparing their name to the title of their Spectrum Guidelines page (i.e. radio => radio group; search => search field). Those were confirmed as the correct link to navigate to.
  • For some components using the Spectrum Contributions site as guidelines, some educated guesses were made. Some components are linked to their default variant (i.e. dialog => standard dialog; pagination => pagination list). Others are linked to a similar name or have a proposed name change (i.e well => wells; stepper => number field).
  • There are 3 components in components/ that are not included in this work: page, site, commons.
  • If you find that the page running locally doesn't render or see a similar Quota exceeded. Failed to execute error in the browser console:
Screenshot 2024-09-13 at 11 29 52 AM

you have to first clear your local storage, then clear your browser cache.

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

Screenshots

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented Sep 18, 2024

⚠️ No Changeset found

Latest commit: d6de19b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@marissahuysentruyt marissahuysentruyt added the wip This is a work in progress, don't judge. label Sep 18, 2024
Copy link
Contributor

github-actions bot commented Sep 18, 2024

🚀 Deployed on https://pr-3129--spectrum-css.netlify.app

Copy link
Contributor

github-actions bot commented Sep 18, 2024

File metrics

Summary

Total size: 4.31 MB*
Total change (Δ): 🔴 ⬆ 0.09 KB (0.00%)

Table reports on changes to a package's main file. Other changes can be found in the collapsed Details section below.

Package Size Δ
modal 5.46 KB 🔴 ⬆ 0.03 KB

Details

modal

Filename Head Compared to base
index-base.css 5.46 KB 🔴 ⬆ 0.03 KB (0.52%)
index-vars.css 5.46 KB 🔴 ⬆ 0.03 KB (0.52%)
index.css 5.46 KB 🔴 ⬆ 0.03 KB (0.52%)
* Size determined by adding together the size of the main file for all packages in the library.
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-772-link-doc-blocks branch 5 times, most recently from 82e4159 to 698a73a Compare September 19, 2024 16:46
Comment on lines 161 to 181
const npmSvg = () => {
return (
<ResourceIconWrapper backgroundColor="rgba(203, 56, 55, 0.1)">
<svg viewBox="0 0 18 7" focusable="false" aria-hidden="true" aria-label="npm">
<path fill="#CB3837" d="M0,0h18v6H9v1H5V6H0V0z M1,5h2V2h1v3h1V1H1V5z M6,1v5h2V5h2V1H6z M8,2h1v2H8V2z M11,1v4h2V2h1v3h1V2h1v3h1V1H11z"></path>
<polygon fill="#FFFFFF" points="1,5 3,5 3,2 4,2 4,5 5,5 5,1 1,1 "></polygon>
<path fill="#FFFFFF" d="M6,1v5h2V5h2V1H6z M9,4H8V2h1V4z"></path>
<polygon fill="#FFFFFF" points="11,1 11,5 13,5 13,2 14,2 14,5 15,5 15,2 16,2 16,5 17,5 17,1 "></polygon>
</svg>
</ResourceIconWrapper>
)
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am super open to feedback on whether or not all of the SVG-related code here makes sense or could be refactored.

@@ -64,5 +64,6 @@
],
"publishConfig": {
"access": "public"
}
},
"componentGuidelinesName": "alert-dialog"
Copy link
Collaborator Author

@marissahuysentruyt marissahuysentruyt Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is actually broken on the docs site. It doesn't use the hyphen. There are a few components that are in similar boats, where our docs site link is broken, but the intended page does exist. Would this PR be a place to fix that (which would be yml changes)? That feels like a really low priority, especially if the docs site is going away anyways.

@@ -53,5 +53,6 @@
],
"publishConfig": {
"access": "public"
}
},
"componentBetaName": "asset-card-beta"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the docs site, the asset card guidelines link actually goes to the card guidelines.

There is an asset card beta on spectrum contributions. That is what is used here instead. Any reservations against that?

@@ -55,5 +55,6 @@
],
"publishConfig": {
"access": "public"
}
},
"componentGuidelinesName": ""
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the docs site, the color handle guidelines link is pointing to the color area guidelines.

Do we want to replicate that link for color handle? Currently, color handle isn't rendering a guidelines card.

@@ -53,5 +53,6 @@
],
"publishConfig": {
"access": "public"
}
},
"componentGuidelinesName": ""
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the docs site, the in-field button guidelines link actually points to the picker guidelines.

Do we want to replicate that link for in-field button? Currently, in-field button isn't rendering a guidelines card.

@@ -52,5 +52,6 @@
],
"publishConfig": {
"access": "public"
}
},
"componentGuidelinesName": ""
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the docs site, the picker button guidelines link actually points to the picker guidelines.

Do we want to replicate that link for picker button? Currently, picker button isn't rendering a guidelines card.

}

else {
throw new Error(`Are you sure you mean "${linkType}"? Please use a valid link type instead: "package", "repository", "guidelines"`);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know how we handle errors. I was just trying something, so feel free to tell me to remove/change this!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good message but if we throw the error, it blocks the page from rendering. Can we log it as a console.warn?

`;

export const ResourceLink = styled.a`
position: relative;
Copy link
Collaborator Author

@marissahuysentruyt marissahuysentruyt Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have two questions about the styles for the link cards that I'd like some opinions on.

  • The resource cards on the docs site do have a background color. I believe that's because they're using the .spectrum-Card class and styles. I didn't immediately add that because I wasn't sure on the whole light/dark mode dilemma I mentioned, and didn't want to hard code anything yet. But should I specify a background color? (probably white?)

  • Most of the font colors & styles are being passed down from the .spectrum-Heading and .spectrum-Body classes, but for some reason the underlay page isn't pulling those in. The styles for .spectrum-Heading and .spectrum-Body are undefined specifically for the underlay page. I believe it's the only page that has blue link text, instead of black, and all of the font weights and sizes are inconsistent to the other component pages. To be safe, should I hard code any of those styles? I know underlay is funky component, so maybe it's implemented in Storybook differently than our other components, and it isn't loading the heading and body styles at the correct time? I wasn't sure of another way to fix that page, or the way to debug the missing styles.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is happening in Dialog too with the fonts, I have no idea why though:
image

How many styles need to be added/hardcoded here to make those two components match the others?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see this happening on dialog, but I did add styles for the font weight, color, font size, line-height and font-family. 8fed17b

Comment on lines 251 to 283
if(linkType === "package") {
// NPM package name and link
packageName = packageJson?.name ?? undefined;
packageLink = (packageName && typeof packageName !== "undefined") ? `https://npmjs.com/${packageName}` : false;
}

else if (linkType === "repository") {
// repo name and link
packageName = packageJson?.name ? packageJson?.name.split('/').pop() : undefined;
packageLink = (packageName && typeof packageName !== "undefined") ? `https://github.com/adobe/spectrum-css/tree/main/components/${packageName}` : false;
}

else if (linkType === "guidelines") {
// guidelines site name and link
packageName = packageJson?.componentGuidelinesName ?? undefined;

// TODO: This may not be a sustainable approach to targeting specific nested components. For example, text area is sort of nested under text field, but we don't surface text area as a separate component, like meter or form. We should probably refactor this to either support nested components more dynamically or potentially un-nest components.
if (nestedComponent === "form") {
packageName = undefined;
}

if (nestedComponent === "meter") {
packageName = nestedComponent;
}

packageLink = (packageName && typeof packageName !== "undefined") ? `https://spectrum.adobe.com/page/${packageName}` : false;

// internal contributions/beta guidelines name and link
packageAltName = (packageName) ? undefined : packageJson?.componentBetaName;

if (!packageLink) {
packageAltLink = (packageAltName && typeof packageAltName !== "undefined") ? `https://spectrum-contributions.corp.adobe.com/page/${packageAltName}` : false;
packageLink = packageAltLink;
}
}
Copy link
Collaborator Author

@marissahuysentruyt marissahuysentruyt Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like there's probably room to refactor this. I'm not a React expert, but some of it feels repetitive. If anybody has ideas on how to more efficiently get the package name and create the right links, I'm all ears! Any suggestions as to how I could do that? Maybe this is ok?

Comment on lines 267 to 272
// TODO: This may not be a sustainable approach to targeting specific nested components. For example, text area is sort of nested under text field, but we don't surface text area as a separate component, like meter or form. We should probably refactor this to either support nested components more dynamically or potentially un-nest components.
if (nestedComponent === "form") {
packageName = undefined;
}

if (nestedComponent === "meter") {
packageName = nestedComponent;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfulton I know we talked on slack about removing the guidelines card for form and meter. I wasn't sure quite sure how to do that, without creating some nestedComponent key in the package.json anyways.

So right now, these are hardcoded. Form will not render a guidelines card. Meter does render a guidelines card that is pointed to its specific guidelines page (as opposed to progress bar's). Let me know what you think of this.

If this isn't to your preference, let me know. I'll remove the meter guidelines and add a note about it into the story documentation for meter & progress bar like we discussed. (i.e. "Meter is implemented using the Progress bar component. For Meter-specific guidance, please see...")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also have a test branch with some extra nesting work on it that fleshes this idea out a little. It's in a very rough-draft state.

@marissahuysentruyt marissahuysentruyt added storybook and removed wip This is a work in progress, don't judge. labels Sep 19, 2024
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-772-link-doc-blocks branch from 174ea48 to 0ac451e Compare September 19, 2024 20:00
@marissahuysentruyt marissahuysentruyt marked this pull request as ready for review September 19, 2024 20:01
@marissahuysentruyt marissahuysentruyt self-assigned this Sep 19, 2024
@marissahuysentruyt marissahuysentruyt changed the title feat: resource list links feat: ResourceListDetails doc block Sep 20, 2024
Copy link
Collaborator

@rise-erpelding rise-erpelding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some first-pass comments here, all looks really good! I went through the validation instructions and didn't see anything major. I noticed you updated allll the components that have their own .mdx page to add the Component details, thanks!

Is there a follow-up card to look into the issues with Switch and Progress Bar?

Noting that I did not see any QuotaExceededErrors when testing, and I tested in Chrome (mostly), Firefox, Safari, and Edge.

}

if (nestedComponent === "meter") {
packageName = nestedComponent;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if anything should be done about this one but I also know you've tagged Patrick about it already, and you called out that Progress Bar isn't fetching the data from npm properly? I noted that Progress bar and Meter each have their own guidelines pages but it doesn't sound like anything can be done about that currently.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if something is funky with meter. It should be navigating to its own guidelines page. d6de19b (it should have a defined componentName and guidelinesLink but I no longer need to hardcode a catch for it. 🤞)


// TODO: This may not be a sustainable approach to targeting specific nested components. For example, text area is sort of nested under text field, but we don't surface text area as a separate component, like meter or form. We should probably refactor this to either support nested components more dynamically or potentially un-nest components.
if (nestedComponent === "form") {
packageName = undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this one isn't linking guidelines for form or fieldlabel, since fieldlabel does have them?
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooo I think this must be an error with my nesting attempt...I'll work on this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is fixed here: d6de19b

.storybook/blocks/ComponentDetails.jsx Outdated Show resolved Hide resolved
.storybook/blocks/ComponentDetails.jsx Show resolved Hide resolved
`;

export const ResourceLink = styled.a`
position: relative;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is happening in Dialog too with the fonts, I have no idea why though:
image

How many styles need to be added/hardcoded here to make those two components match the others?

Copy link
Collaborator

@castastrophe castastrophe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few notes here that might need some refactor so I'll hold off reviewing in more detail until we can talk about it more.

Comment on lines 186 to 188
<svg focusable="false" aria-hidden="true" aria-label="GitHub" viewBox="0 0 36 36">
<path fill="rgb(0, 0, 0)" d="M17.988 2a16.291 16.291 0 0 0-5.147 31.747c.814.149 1.111-.354 1.111-.786 0-.386-.014-1.411-.022-2.77-4.531.984-5.487-2.184-5.487-2.184a4.32 4.32 0 0 0-1.809-2.383c-1.479-1.01.112-.99.112-.99a3.42 3.42 0 0 1 2.495 1.679 3.468 3.468 0 0 0 4.741 1.353 3.482 3.482 0 0 1 1.034-2.177C11.4 25.078 7.6 23.68 7.6 17.438a6.3 6.3 0 0 1 1.677-4.371 5.863 5.863 0 0 1 .16-4.311s1.368-.438 4.479 1.67a15.451 15.451 0 0 1 8.157 0c3.109-2.108 4.475-1.67 4.475-1.67a5.857 5.857 0 0 1 .162 4.311 6.286 6.286 0 0 1 1.674 4.371c0 6.258-3.808 7.635-7.437 8.038a3.888 3.888 0 0 1 1.106 3.017c0 2.177-.02 3.934-.02 4.468 0 .436.293.943 1.12.784A16.292 16.292 0 0 0 17.988 2z"></path>
</svg>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SVGs can be moved into the assets folder and imported if you want to simplify this doc a bit: import GitHubSVG from "../assets/github.svg". Then when using it you can reference it like this: {GitHubSVG}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having some issues at first with this. I was getting the file path to render, the SVG code as a string to render, and finally worked something else out to render the SVGs properly. They're JSX files however, not .svg, so I'm using them as React components instead. I must have been missing something to get the technique you mentioned to work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(linkType === "package") {
// NPM package name and link
packageName = packageJson?.name ?? undefined;
packageLink = (packageName && typeof packageName !== "undefined") ? `https://npmjs.com/${packageName}` : false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NPM and GitHub links make sense to hardcode but I think we should abstract the guidelines and contributions to just a "designLink" and storing them in the package.json. I think there's a lot of great info we could make available from there. Let's store it in a spectrum section maybe like this:

"spectrum": {
	"rootClass": "spectrum-ActionButton",
	"designLink": "https://spectrum.adobe.com/page/action-button",
},

Maybe for packages with more than 1 component we could use an array? (@pfulton what do you think?):

"spectrum": [{
	"rootClass": "spectrum-Form",
	"designLink": "https://spectrum.adobe.com/page/form",
}, {
	"rootClass": "spectrum-FieldLabel",
	"designLink": "https://spectrum.adobe.com/page/field-label",
}],

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if this is sort of what you're thinking. I refactored what I had in all of the package.jsons to include a spectrum array like you suggested. I ended up going with a "guidelinesLink" key within each object, so that when we end up adding Figma links, we can use the "designLink" language for that. If that's overkill, tell me to change it! 😆 I figured Figma and "design" just went better together, rather than our guidelines pages and "design."

I also re-tried getting the nested component stuff to work- maybe it's not a very elegant solution, but I do think it works. It was a little hard to test very thoroughly just because of that weird "undefined.js" thing showing up for progress bar, so I only had the field label/form nesting pair to work against.

d6de19b

}

else {
throw new Error(`Are you sure you mean "${linkType}"? Please use a valid link type instead: "package", "repository", "guidelines"`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good message but if we throw the error, it blocks the page from rendering. Can we log it as a console.warn?

.storybook/blocks/ComponentDetails.jsx Outdated Show resolved Hide resolved
- components that have a valid page on the spectrum guidelines site have
a componentGuidelinesName key now.
- components that do not have a valid page on the spectrum guidelines
site have a componentBetaName key that will point to the
spectrum-contributions site.
- for components that do not any guidelines, setting the
componentGuidelinesName key to an empty string in the package.json will
make sure the guidelines resource card doesn't render.
The ResourceListDetails fetches data from each storybook component's
package.json, specifically utilizing the package name and optional
componentGuidelinesName. It then creates links to the spectrum
guidelines, github, and npm sites. If a component doesn't have a
spectrum guidelines page, it uses the optional componentBetaName and the
spectrum-contributions site instead.

- creates new `styled` components related to the resource section, any
element wrappers and links
- creates ResourceListDetails doc block
- creates ResourceListContent component (which are the individual
resource cards)
- adds some helper functions to generate SVGs corresponding to the links,
switch statements, mapping text, etc.
this applies to form and meter. Form should no longer render a guidelines
link card, and meter should navigate to its own guidelines page instead
of progress bar's.
- update spacing for if() statement
- render ResourceListDetails in ComponentDetails
- console.warn instead of throw an error
- hard codes styles for cards
- extracts SVG code to individual jsx files
- imports those SVG jsx files to use a components
- replaces/refactors svg functions to render new svg components
@marissahuysentruyt marissahuysentruyt force-pushed the marissahuysentruyt/css-772-link-doc-blocks branch from 0ac451e to 6d28aa6 Compare September 27, 2024 17:13
- creates a `spectrum` key in each component's package.json to use in
ComponentDetails
- `spectrum` array holds metadata for components and/or nested
components, like the componentName, the guidelineLink, and rootClass
- eventually we may be able to add designLink to add Figma links to this
block
- reorganizes file so ResourceLinkContent and ResourceListDetails are
closer to CopmonentDetails, and all fetching/processing helper functions
are together
- addresses missing field label guidelines link
- removes some hardcoded nestedComponent code in favor for a for loop
- indentation fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants