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

[SkeletonBodyText] Add wrapper to SkeletonBodyText #9764

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

andy-schneidr
Copy link
Contributor

Wrap individual lines of SkeletonBodyText in a div with width 100% This allows the lines to fill available space in cases when width isn't specified, as an item in a HorizontalStack for example.

WHY are these changes introduced?

Fixes #9703

WHAT is this pull request doing?

Adds a <div width=100%> wrapper around <SkeletonBodyText> lines, so that they'll fill available horizontal space.

Before:
image

After:
image

As a note, in the example <SkeletonThumbnail> has a tendency to get squished in <HorizontalStack>s. Is this something we want to address? The most straightforward workaround I've found is to just wrap it in a <div>, no other styling required.

How to 🎩

With the changes pulled down, run yarn dev and take a look at the examples under SkeletonBodyText and SkeletonPage - There shouldn't be any changes, with the exception of SkeletonBodyText - Default - The last line shows with a width of 80% now. I think this is closer to the intended behaviour, looking at the difference between the example in the doc and how it looks in the code sandbox 😮

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

import {
  Card,
  Text,
  HorizontalStack,
  Layout,
  LegacyStack,
  Page,
  SkeletonBodyText,
  SkeletonThumbnail,
} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      <Card>
        <Text variant="headingMd" as="h2">
          3 Lines, LegacyStack with LegacyStack.Item fill :D
        </Text>
        <Layout.Section />
        <LegacyStack wrap={false}>
          <SkeletonThumbnail size="small" />
          <LegacyStack.Item fill>
            <SkeletonBodyText lines={3} />
          </LegacyStack.Item>
        </LegacyStack>
      </Card>
      <Layout.Section />
      <Card>
        <Text variant="headingMd" as="h2">
          3 lines, in a HorizontalStack
        </Text>
        <Layout.Section />
        <HorizontalStack wrap={false} blockAlign="start" gap="4">
          <SkeletonThumbnail size="small" />
          <SkeletonBodyText lines={3} />
        </HorizontalStack>
      </Card>
    </Page>
  );
}

🎩 checklist

@andy-schneidr andy-schneidr added the 🤖Skip Changelog Causes CI to ignore changelog update check. label Jul 19, 2023
@andy-schneidr
Copy link
Contributor Author

@jesstelford Feel free to add/remove reviewers to this at your leisure, I'm a bit unfamiliar as to who else would be a good candidate! Also, let me know if you'd like to see a changelog entry for this.

Copy link
Contributor

@jesstelford jesstelford left a comment

Choose a reason for hiding this comment

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

This looks good to me, but it needs a changset (patch) for the @shopify/polaris package:

# in the root
yarn changeset

Wrap individual lines of SkeletonBodyText in a div with width 100%
This allows the lines to fill available space in cases when width isn't specified,
as an item in a HorizontalStack for example.
@andy-schneidr andy-schneidr force-pushed the skeleton-body-text-width-container branch from 0919862 to 519a942 Compare July 24, 2023 14:55
@andy-schneidr andy-schneidr removed the 🤖Skip Changelog Causes CI to ignore changelog update check. label Jul 24, 2023
@andy-schneidr
Copy link
Contributor Author

This looks good to me, but it needs a changeset (patch) for the @shopify/polaris package

Thanks @jesstelford! I've added a changeset 😄 Let me know if it needs any changes.

@jesstelford jesstelford merged commit d3315de into main Jul 25, 2023
13 checks passed
@jesstelford jesstelford deleted the skeleton-body-text-width-container branch July 25, 2023 02:12
This was referenced Jul 25, 2023
sam-b-rose pushed a commit that referenced this pull request Jul 25, 2023
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/[email protected]

### Minor Changes

- [#9820](#9820)
[`5fe84e33b`](5fe84e3)
Thanks [@zakwarsame](https://github.com/zakwarsame)! - Added a `variant`
prop to ActionList for applying avatar size and left indentation space
and border to items

### Patch Changes

- [#9773](#9773)
[`a5f68c9a5`](a5f68c9)
Thanks [@jesstelford](https://github.com/jesstelford)! - [Scrollable]
shadow overlays scrollable content correctly.


- [#9764](#9764)
[`d3315de2e`](d3315de)
Thanks [@andy-schneidr](https://github.com/andy-schneidr)! - Wrap
SkeletonBodyText lines in a div (width 100%)


- [#9831](#9831)
[`078bddad1`](078bdda)
Thanks [@zakwarsame](https://github.com/zakwarsame)! - Updated the user
menu's avatar to include `name`


- [#9828](#9828)
[`80c87bb1a`](80c87bb)
Thanks [@felipeleusin](https://github.com/felipeleusin)! - [Frame]
Applies margin to Content when using sidebar

## @shopify/[email protected]



## [email protected]

### Patch Changes

- Updated dependencies
\[[`5fe84e33b`](5fe84e3),
[`a5f68c9a5`](a5f68c9),
[`d3315de2e`](d3315de),
[`078bddad1`](078bdda),
[`80c87bb1a`](80c87bb)]:
    -   @shopify/[email protected]

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
juzser pushed a commit to juzser/polaris that referenced this pull request Jul 27, 2023
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/[email protected]

### Minor Changes

- [Shopify#9820](Shopify#9820)
[`5fe84e33b`](Shopify@5fe84e3)
Thanks [@zakwarsame](https://github.com/zakwarsame)! - Added a `variant`
prop to ActionList for applying avatar size and left indentation space
and border to items

### Patch Changes

- [Shopify#9773](Shopify#9773)
[`a5f68c9a5`](Shopify@a5f68c9)
Thanks [@jesstelford](https://github.com/jesstelford)! - [Scrollable]
shadow overlays scrollable content correctly.


- [Shopify#9764](Shopify#9764)
[`d3315de2e`](Shopify@d3315de)
Thanks [@andy-schneidr](https://github.com/andy-schneidr)! - Wrap
SkeletonBodyText lines in a div (width 100%)


- [Shopify#9831](Shopify#9831)
[`078bddad1`](Shopify@078bdda)
Thanks [@zakwarsame](https://github.com/zakwarsame)! - Updated the user
menu's avatar to include `name`


- [Shopify#9828](Shopify#9828)
[`80c87bb1a`](Shopify@80c87bb)
Thanks [@felipeleusin](https://github.com/felipeleusin)! - [Frame]
Applies margin to Content when using sidebar

## @shopify/[email protected]



## [email protected]

### Patch Changes

- Updated dependencies
\[[`5fe84e33b`](Shopify@5fe84e3),
[`a5f68c9a5`](Shopify@a5f68c9),
[`d3315de2e`](Shopify@d3315de),
[`078bddad1`](Shopify@078bdda),
[`80c87bb1a`](Shopify@80c87bb)]:
    -   @shopify/[email protected]

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.

[SkeletonBodyText] [HorizontalStack] Allow item to fill remaining horizontal space
2 participants