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

[BDES-96] [BpkCardList] Add Grid and Stack Layouts #3697

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

FireRedNinja
Copy link
Contributor

@FireRedNinja FireRedNinja commented Dec 19, 2024

Remember to include the following changes:

  • Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [KOA-123][BpkButton] Updating the colour
  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Accessibility tests
    • The following checks were performed:
      • Ability to navigate using a keyboard only
      • Zoom functionality (Deque University explanation):
        • The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
        • Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
      • Ability to navigate using a screen reader only
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

Screenshots

Grid with Header Button

image

Stack with Header Button

image

Grid with Button Accessory

image

Stack with Button Accessory

image

Grid with Expand Accessory

image
image

Stack with Expand Accessory

image

@FireRedNinja FireRedNinja added the patch Patch production bug label Dec 19, 2024
Copy link

Visit https://backpack.github.io/storybook-prs/3697 to see this build running in a browser.

@FireRedNinja FireRedNinja changed the title [BDES-96] [BpkCardList] Grid and Stack Layouts [BDES-96] [BpkCardList] Add Grid and Stack Layouts Dec 19, 2024
Copy link

github-actions bot commented Dec 19, 2024

Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

⚠️

Package source files (e.g. packages/package-name/src/Component.tsx) were updated, but type files weren't. Have you checked that no types have changed?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against e911f26

Copy link

Visit https://backpack.github.io/storybook-prs/3697 to see this build running in a browser.

Copy link

Visit https://backpack.github.io/storybook-prs/3697 to see this build running in a browser.

buttonHref=""
onButtonClick={() => null}
cardList={cards(DestinationCard)}
layoutDesktop="grid"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd create some constants and export them for all these to avoid consumers having to hardcode these

Copy link
Contributor

Choose a reason for hiding this comment

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

small typo in the file name?

onButtonClick,
title,
} = props;

const button = buttonText && (
<BpkButtonV2 onClick={onButtonClick} href={buttonHref}>{buttonText}</BpkButtonV2>
const button = buttonText && accessory !== 'button' && (
Copy link
Contributor

Choose a reason for hiding this comment

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

likewise with this - a constant would be useful to avoid consumers misusing the component due to a typo

} = props;

let defaultInitiallyShownCards: number;
if (accessory === ACCESSORY_TYPES.Expand) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this depends on the accessory. From the API table:

3 cards displayed by default, but you can change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for the case when more than 3 cards are given but the user don't want to use an expand accessory. It would look confusing for the user as it would simply look like the component is broken with only 3 cards showing

collapsed={collapsed}
setCollapsed={setCollapsed}
>
{expandText || ''}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there's a way in TS to ensure expandText is passed when accessory is expand 🤔 likewise for button and button text

const buttonOnClick = () => {
if (collapsed) {
showContent();
setCollapsed(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better not to directly change the state here and instead pass a callback from the parent for the onClick functionality. In fact, I think showContent handles that already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Patch production bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants