-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Docs
DirectiveCard and DoDont refactor
#10581
Conversation
ba9aeb4
to
c01e043
Compare
> :last-child { | ||
margin-bottom: 0; | ||
:last-child { | ||
margin-block: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the >
operator so that even when wrapped inStack
the last child node will still have its block margin removed.
Not sure if this is a wise choice or not, so happy for an alternative suggestion.
import ImageThumbnail from '../../../ThumbnailPreview'; | ||
import styles from './styles.module.scss'; | ||
|
||
export enum DirectiveStatusName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how I feel about ts enum as an API, but using it here for consistency since we also use this pattern in StatusBadge
.
); | ||
}; | ||
|
||
export const Pill = ({status}: {status: DirectiveStatus}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided to just reimplement StatusBadge
here, mainly because I don't want to tie these Directive status' to the status in StatusBadge
canonically used to denote component and page status (new deprecated etc.)
Not a strongly held opinion, happy to refactor if others have strong opinions 👍
… a composition of the DirectiveCard
c01e043
to
c4fe9a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, pushed up one tiny change to remove the headings for the older uses for DoDont
@@ -44,8 +43,7 @@ export const DoDont = ({children}: PropsWithChildren) => { | |||
while (i < childrenArray.length) { | |||
target = childrenArray[i].props.children.startsWith('Don') ? donts : dos; | |||
|
|||
// Add the heading | |||
target.push(childrenArray[i]); | |||
// skip the headings in older uses of <DoDont> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,5 +1,9 @@ | |||
@import '../../styles/mixins.scss'; | |||
.Card { | |||
@include dark-mode { | |||
box-shadow: var(--card-shadow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added to match the other "cards" in darkmode around the site
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
<!-- ☝️How to write a good PR title: - Prefix it with [ComponentName] (if applicable), for example: [Button] - Start with a verb, for example: Add, Delete, Improve, Fix… - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ### WHY are these changes introduced? Fixes Shopify#10571 ### WHAT is this pull request doing? - `Docs` Add DirectiveCard component, and refactor DoDont components as a composition of the DirectiveCard - `Docs` update Card styles to override last-child margin of *all* children With Image: <img width="450" alt="Screenshot 2023-09-20 at 4 21 31 pm" src="https://github.com/Shopify/polaris/assets/12119389/dd05c87c-7e99-4eee-85da-16c84b80e931"> Do Don't: <img width="894" alt="Screenshot 2023-09-20 at 4 22 04 pm" src="https://github.com/Shopify/polaris/assets/12119389/b6a53b61-f6f1-4315-ab67-2e08e75f6884"> ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) <!-- Give as much information as needed to experiment with the component in the playground. --> <details> <summary>Copy-paste this code in <code>playground/Playground.tsx</code>:</summary> ```jsx import React from 'react'; import {Page} from '../src'; export function Playground() { return ( <Page title="Playground"> {/* Add the code you want to test in here */} </Page> ); } ``` </details> ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide --------- Co-authored-by: Yuraima Estevez <yuraima.estevez@shopify.com>
WHY are these changes introduced?
Fixes #10571
WHAT is this pull request doing?
Docs
Add DirectiveCard component, and refactor DoDont components as a composition of the DirectiveCardDocs
update Card styles to override last-child margin of all childrenWith Image:
Do Don't:
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes