Skip to content

Conversation

@kyledurand
Copy link
Member

@kyledurand kyledurand commented Oct 26, 2022

This change reduces markup for the following properties:

<Box padding="1" borderRadius="1" border="dark">Hello</Box>

Markup before:
image

Markup after:
image

Make sure to 🎩 with nested elements

Box playground
import React from 'react';

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

const props = {background: 'surface-attention' as BoxProps['background']};

export function Playground() {
  return (
    <Page title="Playground">
      <Box padding="2">
        <AlphaStack>
          <Box padding="3" {...props}>
            padding
          </Box>
          <Box paddingInlineStart="3" {...props}>
            paddingInlineStart
          </Box>
          <Box paddingInlineEnd="3" {...props}>
            paddingInlineEnd
          </Box>
          <Box paddingBlockStart="3" {...props}>
            paddingBlockStart
          </Box>
          <Box paddingBlockEnd="3" {...props}>
            paddingBlockEnd
          </Box>

          <hr style={{width: '100%'}} />

          <Box border="dark" {...props}>
            border
          </Box>
          <Box borderInlineStart="dark" {...props}>
            borderInlineStart
          </Box>
          <Box borderInlineEnd="dark" {...props}>
            borderInlineEnd
          </Box>
          <Box borderBlockStart="dark" {...props}>
            borderBlockStart
          </Box>
          <Box borderBlockEnd="dark" {...props}>
            borderBlockEnd
          </Box>

          <hr style={{width: '100%'}} />

          <Box borderRadius="4" {...props}>
            borderRadius
          </Box>
          <Box borderRadiusStartStart="4" {...props}>
            borderRadiusStartStart
          </Box>
          <Box borderRadiusStartEnd="4" {...props}>
            borderRadiusStartEnd
          </Box>
          <Box borderRadiusEndStart="4" {...props}>
            borderRadiusEndStart
          </Box>
          <Box borderRadiusEndEnd="4" {...props}>
            borderRadiusEndEnd
          </Box>
        </AlphaStack>
      </Box>
    </Page>
  );
}

@kyledurand kyledurand self-assigned this Oct 26, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2022

size-limit report 📦

Path Size
polaris-react-cjs 209.44 KB (-0.03% 🔽)
polaris-react-esm 135.84 KB (-0.04% 🔽)
polaris-react-esnext 191.42 KB (-0.04% 🔽)
polaris-react-css 41.71 KB (-0.03% 🔽)

@kyledurand kyledurand changed the title Update box to use logical properties [Box] Use logical properties and use single custom property where possible Oct 26, 2022
@kyledurand kyledurand force-pushed the box_logical-properties branch from 450d4e5 to 5fa7c85 Compare October 26, 2022 18:46
@kyledurand kyledurand force-pushed the box_logical-properties branch from ba9c438 to 8635321 Compare October 26, 2022 19:57
@kyledurand kyledurand marked this pull request as ready for review October 26, 2022 20:02
Copy link
Contributor

@laurkim laurkim left a comment

Choose a reason for hiding this comment

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

I think this would be a major change, not patch.
Because we're changing the prop names, all the places that use Box in this repo (and subsequently Shopify/web when this is released) will have to be updated to use the new prop names.

@kyledurand
Copy link
Member Author

I think it's ok to break alpha component props in non major releases, that's why we created the alpha status for Grid. We'll just have to make sure we address these issues where they crop up. No changes needed within our repo

@laurkim laurkim dismissed their stale review October 27, 2022 13:55

Still an Alpha component so okay to change props in non-major release

@laurkim laurkim self-requested a review October 27, 2022 13:55
Copy link
Contributor

@laurkim laurkim left a comment

Choose a reason for hiding this comment

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

💯
Changes lgtm, just needs a small update to the AlphaCard.test.tsx file for the failing node check 👍

@kyledurand kyledurand requested a review from laurkim October 27, 2022 14:35
Copy link
Contributor

@laurkim laurkim left a comment

Choose a reason for hiding this comment

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

Tophatted and lgtm 💯
I think we'd just need to merge the version packages PR after this so that the style guide has the updated styling.

Copy link
Contributor

@aveline aveline left a comment

Choose a reason for hiding this comment

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

Nice! I noticed it's missing a Box.stories.tsx file. Maybe we should add one?

@kyledurand kyledurand merged commit e53f790 into main Oct 27, 2022
@kyledurand kyledurand deleted the box_logical-properties branch October 27, 2022 16:06
@github-actions github-actions bot mentioned this pull request Oct 27, 2022
laurkim pushed a commit that referenced this pull request Oct 27, 2022
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @shopify/polaris@10.10.0

### Minor Changes

- [#7538](#7538)
[`a595fa3ca`](a595fa3)
Thanks [@laurkim](https://github.com/laurkim)! - Added responsive
styling to `Text` for `heading2xl`, `heading3xl`, and `heading4xl`
variants


- [#7546](#7546)
[`e5f84f0eb`](e5f84f0)
Thanks [@laurkim](https://github.com/laurkim)! - Added responsive
styling to the `Text` `headingXl` and `headingLg` variants

### Patch Changes

- [#7534](#7534)
[`e53f7901c`](e53f790)
Thanks [@kyledurand](https://github.com/kyledurand)! - Update box to use
logical properties, condense single value into single custom property

## @shopify/plugin-polaris@0.0.14



## polaris-for-figma@0.0.27

### Patch Changes

- Updated dependencies
\[[`e53f7901c`](e53f790),
[`a595fa3ca`](a595fa3),
[`e5f84f0eb`](e5f84f0)]:
    -   @shopify/polaris@10.10.0

## polaris.shopify.com@0.23.2

### Patch Changes

- [#7544](#7544)
[`af478626d`](af47862)
Thanks [@martenbjork](https://github.com/martenbjork)! - Fixes an issue
that caused the reduced-motion fallback to appear broken on the home
page.

- Updated dependencies
\[[`e53f7901c`](e53f790),
[`a595fa3ca`](a595fa3),
[`e5f84f0eb`](e5f84f0)]:
    -   @shopify/polaris@10.10.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.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