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

SelectPanel: Add variant=modal #5198

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft

Conversation

siddharthkp
Copy link
Member

@siddharthkp siddharthkp commented Oct 31, 2024

Couple of followup improvements (not blockers for this PR):

  1. add better API for secondary action slot
  2. add loading state for Save button

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@siddharthkp siddharthkp self-assigned this Oct 31, 2024
@github-actions github-actions bot added the staff Author is a staff member label Oct 31, 2024
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 31, 2024
@github-actions github-actions bot temporarily deployed to storybook-preview-5198 October 31, 2024 15:29 Inactive
@siddharthkp siddharthkp changed the base branch from main to select-panel-full-variant October 31, 2024 15:29
Copy link
Contributor

github-actions bot commented Oct 31, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 98.8 KB (+0.25% 🔺)
packages/react/dist/browser.umd.js 99.1 KB (+0.11% 🔺)

Copy link

changeset-bot bot commented Oct 31, 2024

⚠️ No Changeset found

Latest commit: fdc0bd4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

onCancel={() => setSelected(initialItems)}
// backward compatible API choice
// TODO: improve this API, rename it to a single secondaryAction or secondaryFooterSlotSomething
footer={<Button size="small">Edit labels</Button>}
Copy link
Member Author

@siddharthkp siddharthkp Oct 31, 2024

Choose a reason for hiding this comment

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

non blocking improvement 1/2: While footer is backward compatible, it's not obvious what it means. What we want here is a "secondary action".

Looking at usage (3 instances), we have

  • Button
  • LinkButton
  • custom FooterActions component that has a spinner or an error message! (these cases are filling in for missing features and we should be able to simplify them with error messages and loading states)

>
Cancel
</Button>
{/* TODO: loading state for save? */}
Copy link
Member Author

@siddharthkp siddharthkp Oct 31, 2024

Choose a reason for hiding this comment

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

non blocking improvement 2/2: Once we have loading states, add one for "saving"

Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

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

Thanks for working on this super quickly 🔥 Let a few questions. curious to hear your thoughts

@@ -31,23 +31,40 @@ interface SelectPanelMultiSelection {
onSelectedChange: (selected: ItemInput[]) => void
}

type OpenGestures = 'anchor-click' | 'anchor-key-press'
Copy link
Member

Choose a reason for hiding this comment

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

❤️

<h1>Multi Select Panel as Modal</h1>
<SelectPanel
variant="modal"
onCancel={() => setSelected(initialItems)}
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if it is doable/makes sense to handle the cancel in the component? 🤔 We can tae a call back in case there is anything else needs to be done after the cancel. Curious to hear what you think

Copy link
Member Author

@siddharthkp siddharthkp Nov 1, 2024

Choose a reason for hiding this comment

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

I would like that a lot. A combination of onSubmit and onCancel so that developers don't have to take care of transient state

buuuuut that doesn't match what we have right now. onSelectedChange is fired immediately when an item is selected and the developer are expected to keep track of selected items and pass them back to SelectPanel 🤷

I'd like to explore an API that abstracts the transient state but that is likely going to be a breaking change, so probably as a bonus task right at the end of the project

Copy link
Member

@broccolinisoup broccolinisoup Nov 4, 2024

Choose a reason for hiding this comment

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

buuuuut that doesn't match what we have right now. onSelectedChange is fired immediately when an item is selected and the developer are expected to keep track of selected items and pass them back to SelectPanel 🤷

Yeah, I see! We don't have much control over the selected items, and it would probably violate the pattern if we try managing the state of the "selected" just for cancel

I'd like to explore an API that abstracts the transient state but that is likely going to be a breaking change, so probably as a bonus task right at the end of the project

That would be interesting to explore! Yeah, no worries at all.

| {
// do we need keep the old variants for backward-compat?
// there isn't any usage in dotcom
variant: 'anchored' | FilteredActionListProps['variant']
Copy link
Member

Choose a reason for hiding this comment

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

do we need keep the old variants for backward-compat? there isn't any usage in dotcom

I think we should. Although I am not sure if should merge the old variants and the new ones since they seem different variants to me. The new one is more of a type (modal, anchored) and the other (full and inset ) feels related to the stylings of the panel.

One idea might be (For the sake of keeping things uncomplicated) we can merge them and immediately deprecated the old variants?

Curious to hear your thoughts

Copy link
Member Author

@siddharthkp siddharthkp Nov 1, 2024

Choose a reason for hiding this comment

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

Although I am not sure if should merge the old variants and the new ones since they seem different variants to me

That's very true.

I personally would like to get rid of the old ones because it's a design changing option that has leaked out of deprecated ActionList all the way to SelectPanel. I don't think we want folks to use the full width with SelectPanel.

One idea might be (For the sake of keeping things uncomplicated) we can merge them and immediately deprecated the old variants?

I like that

Luckily, there is no usage in dotcom and only 5 instances in internal status page, so it feels like we can deprecate/remove them for modern ActionList in SelectPanel

@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/350395

@primer-integration
Copy link

🔴 golden-jobs completed with status failure.

@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Nov 7, 2024
@github-actions github-actions bot temporarily deployed to storybook-preview-5198 November 7, 2024 17:29 Inactive
Base automatically changed from selectpanel-use-anchored-position to main November 8, 2024 08:45
Copy link
Member Author

Choose a reason for hiding this comment

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

I think the hover color is different?? It's really hard to tell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: failing Changes in this PR cause breaking changes in gh/gh staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants