Skip to content

Conversation

@laurkim
Copy link
Contributor

@laurkim laurkim commented Aug 23, 2022

WHY are these changes introduced?

Resolves #6892.

WHAT is this pull request doing?

Adds a new alpha Box component.


Using Box to recreate the Card component
Using `Box` to recreate the `Card` component

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';

import {Page, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}

🎩 checklist

@laurkim laurkim self-assigned this Aug 23, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Aug 23, 2022

size-limit report 📦

Path Size
polaris-react-cjs 201.34 KB (+0.29% 🔺)
polaris-react-esm 129.42 KB (+0.38% 🔺)
polaris-react-esnext 183.81 KB (+0.42% 🔺)
polaris-react-css 40.8 KB (+0.46% 🔺)

@laurkim laurkim changed the base branch from main to layout-foundations-prototype August 23, 2022 17:40
@laurkim laurkim force-pushed the lo/add-box-component branch 2 times, most recently from 9c6f853 to 6e8f158 Compare August 24, 2022 16:23
@laurkim laurkim changed the title [Layout foundations] Add Box component [Layout foundations][WIP] Add Box component Aug 24, 2022
@laurkim laurkim force-pushed the lo/add-box-component branch from 42f8403 to 13b0d4e Compare August 25, 2022 17:06
@laurkim laurkim changed the title [Layout foundations][WIP] Add Box component [Layout foundations][WIP] Add alpha Box component Aug 29, 2022
laurkim and others added 4 commits August 29, 2022 12:45
Including the `margin/padding` property was causing overrides when combining with `marginTop` or `paddingLeft`, for example.

Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
@laurkim laurkim force-pushed the lo/add-box-component branch from 456480e to 20380ce Compare August 29, 2022 16:45
@laurkim
Copy link
Contributor Author

laurkim commented Aug 29, 2022

Example usage of margin and padding with specific overrides.

Copy-paste this code in playground/Playground.tsx:
import React from 'react';

import {Page, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="background"
        border="radius-1"
        shadow="deep"
        padding="2"
        // uncomment the below line to test an override for padding left
        // paddingLeft="5"
        margin="2"
        // uncomment the below line to test an override for margin top
        // marginTop="5"
      >
        <h1>hello</h1>
      </Box>
    </Page>
  );
}

Example usage of border and borderRadius with specific overrides.

Copy-paste this code in playground/Playground.tsx:
import React from 'react';

import {Page, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        padding="3"
        margin="2"
        borderRadius="radius-2"
        borderRadiusBottomRight="radius-4"
        borderRadiusTopRight="radius-4"
        border="dark"
        borderTop="base"
      >
        <h1>hello</h1>
      </Box>
    </Page>
  );
}

@laurkim laurkim changed the title [Layout foundations][WIP] Add alpha Box component [Layout foundations] Add alpha Box component Aug 29, 2022
@laurkim laurkim marked this pull request as ready for review August 29, 2022 17:40
shadow?: DepthTokenScale;
}

type PolymorphicBox = Polymorphic.ForwardRefComponent<'div', BoxBaseProps>;
Copy link
Member

Choose a reason for hiding this comment

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

Would we want to start with a more opinionated list? Then add flexibility later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I originally tried building Box out that way but was running into a lot of TS errors. I can revisit and see if I can get it working without @radix-ui/react-polymorphic package if we prefer that approach?

Copy link
Member

Choose a reason for hiding this comment

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

I think initially if we can get this working without allowing all the HTML elements that would be ace.

Copy link
Member

@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.

This looking good so far! One other thing I noticed is that I can make a box with a dark background but can't change the text color. So the text gets lost. Can that be addressed within the Text component? (I haven't looked at it recently)

@laurkim
Copy link
Contributor Author

laurkim commented Aug 30, 2022

This looking good so far! One other thing I noticed is that I can make a box with a dark background but can't change the text color. So the text gets lost. Can that be addressed within the Text component? (I haven't looked at it recently)

@kyledurand The Text component should support color but we've limited to four (success | critical | warning | subdued). Did the color prop on the component not work as expected?

@kyledurand
Copy link
Member

kyledurand commented Aug 30, 2022

Did the color prop on the component not work as expected?

I didn't try the text component but I think we should allow the same colors we do for background in a color prop for Box. Especially if we're limiting text to just those four variants.

Copy link
Member

@alex-page alex-page left a comment

Choose a reason for hiding this comment

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

Happy to ship and iterate in the layout-foundations-prototype branch @laurkim

@laurkim
Copy link
Contributor Author

laurkim commented Aug 30, 2022

Here are the two issues I've created to track the work discussed on this PR.
Box without polymorphic dependency
color prop

I'll create subsequent PRs to address them.

@laurkim laurkim merged commit 34fc31f into layout-foundations-prototype Aug 30, 2022
@laurkim laurkim deleted the lo/add-box-component branch August 30, 2022 18:47
laurkim added a commit that referenced this pull request Aug 30, 2022
### WHY are these changes introduced?

Resolves #6892. 

<!--
  Context about the problem that’s being addressed.
-->

### WHAT is this pull request doing?

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

### 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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
laurkim added a commit that referenced this pull request Sep 6, 2022
Resolves #6892.

<!--
  Context about the problem that’s being addressed.
-->

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

🖥 [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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}
```

</details>

- [ ] 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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
chazdean pushed a commit that referenced this pull request Sep 6, 2022
Resolves #6892.

<!--
  Context about the problem that’s being addressed.
-->

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

🖥 [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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}
```

</details>

- [ ] 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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
laurkim added a commit that referenced this pull request Sep 9, 2022
Resolves #6892.

<!--
  Context about the problem that’s being addressed.
-->

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

🖥 [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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}
```

</details>

- [ ] 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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
laurkim added a commit that referenced this pull request Sep 9, 2022
Resolves #6892.

<!--
  Context about the problem that’s being addressed.
-->

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

🖥 [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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}
```

</details>

- [ ] 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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
laurkim added a commit that referenced this pull request Sep 13, 2022
Resolves #6892.

<!--
  Context about the problem that’s being addressed.
-->

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

🖥 [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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}
```

</details>

- [ ] 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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
laurkim added a commit that referenced this pull request Sep 15, 2022
Resolves #6892.

<!--
  Context about the problem that’s being addressed.
-->

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

🖥 [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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}
```

</details>

- [ ] 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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
laurkim added a commit that referenced this pull request Sep 30, 2022
Resolves #6892.

<!--
  Context about the problem that’s being addressed.
-->

Adds a new alpha `Box` component.
    <details>
      <summary>Using `Box` to recreate the `Card` component</summary>
      <img src="https://user-images.githubusercontent.com/26749317/187263883-0e8194f5-fbd8-4227-bdf5-66e868ffa573.png" alt="Using `Box` to recreate the `Card` component">
    </details>

🖥 [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, Card, Text, Box} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
      <Box
        background="surface"
        borderRadius="radius-2"
        padding="5"
        shadow="card"
      >
        <Text as="h2" variant="headingMd">
          Online store dashboard
        </Text>
        <Text as="p" variant="bodyMd">
          This was made using the 📦 Box 📦 component.
        </Text>
      </Box>
      <div
        style={{
          borderTop: 'var(--p-border-divider)',
          marginTop: 'var(--p-space-8)',
          marginBottom: 'var(--p-space-8)',
        }}
      ></div>
      <Card title="Online store dashboard" sectioned>
        <Text as="p" variant="bodyMd">
          This was made using the 🃏 Card 🃏 component.
        </Text>
      </Card>
    </Page>
  );
}
```

</details>

- [ ] 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: Aaron Casanova <[email protected]>
Co-authored-by: Aveline Thelen <[email protected]>
Co-authored-by: Alex Page <[email protected]>
Co-authored-by: Kyle Durand <[email protected]>
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.

[Layout foundations] Add alpha Box component

3 participants