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

Docs DirectiveCard and DoDont refactor #10581

Merged
merged 4 commits into from
Sep 20, 2023
Merged

Docs DirectiveCard and DoDont refactor #10581

merged 4 commits into from
Sep 20, 2023

Conversation

gwyneplaine
Copy link
Contributor

@gwyneplaine gwyneplaine commented Sep 20, 2023

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 DirectiveCard
  • Docs update Card styles to override last-child margin of all children

With Image:
Screenshot 2023-09-20 at 4 21 31 pm

Do Don't:
Screenshot 2023-09-20 at 4 22 04 pm

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
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>
  );
}

🎩 checklist

@gwyneplaine gwyneplaine force-pushed the v12/10571 branch 2 times, most recently from ba9aeb4 to c01e043 Compare September 20, 2023 06:36
@gwyneplaine
Copy link
Contributor Author

Cards look very shoddy in darkmode rn due to hardcoded box-shadow values:
Screenshot 2023-09-20 at 4 38 31 pm

Do we have existing shadow tokens (or proposed semantic token / value pair) we can use? If not I'll leave it as something we pick up later

@gwyneplaine gwyneplaine marked this pull request as ready for review September 20, 2023 06:41
> :last-child {
margin-bottom: 0;
:last-child {
margin-block: 0;
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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}) => {
Copy link
Contributor Author

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 👍

@gwyneplaine gwyneplaine requested review from yurm04 and jesstelford and removed request for yurm04 September 20, 2023 06:48
Copy link
Contributor

@yurm04 yurm04 left a 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>
Copy link
Contributor

Choose a reason for hiding this comment

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

removed the heading since it looks redundant with the new design

Before
Screenshot 2023-09-20 at 11 19 31 AM

After
Screenshot 2023-09-20 at 11 15 08 AM

@@ -1,5 +1,9 @@
@import '../../styles/mixins.scss';
.Card {
@include dark-mode {
box-shadow: var(--card-shadow);
Copy link
Contributor

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

Copy link
Contributor

@kyledurand kyledurand left a 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

@yurm04 yurm04 merged commit d505fa4 into next Sep 20, 2023
7 checks passed
@yurm04 yurm04 deleted the v12/10571 branch September 20, 2023 17:47
AnnaCheba pushed a commit to AnnaCheba/polaris that referenced this pull request Apr 22, 2024
<!--
  ☝️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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants