Skip to content

SelectPanel: Add variant=modal - #5198

Closed
siddharthkp wants to merge 28 commits into
mainfrom
selectpanel-modal-variant-2
Closed

SelectPanel: Add variant=modal#5198
siddharthkp wants to merge 28 commits into
mainfrom
selectpanel-modal-variant-2

Conversation

@siddharthkp

@siddharthkpsiddharthkp commented Oct 31, 2024

Copy link
Copy Markdown
Member

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

@siddharthkpsiddharthkp self-assigned this Oct 31, 2024
@github-actionsgithub-actionsBot added the staff Author is a staff member label Oct 31, 2024
@github-actions

Copy link
Copy Markdown
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-actionsgithub-actionsBot 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-actionsBottemporarily deployed to storybook-preview-5198 October 31, 2024 15:29 Inactive
@siddharthkp
siddharthkp changed the base branch from main to select-panel-full-variantOctober 31, 2024 15:29
@github-actions

github-actionsBot commented Oct 31, 2024

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js98.8 KB (+0.25% 🔺)
packages/react/dist/browser.umd.js99.1 KB (+0.11% 🔺)

@changeset-bot

changeset-botBot commented Oct 31, 2024

Copy link
Copy Markdown

⚠️ 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>}

@siddharthkpsiddharthkpOct 31, 2024

Copy link
Copy Markdown
MemberAuthor

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? */}

@siddharthkpsiddharthkpOct 31, 2024

Copy link
Copy Markdown
MemberAuthor

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"

@broccolinisoupbroccolinisoup left a comment

Copy link
Copy Markdown
Member

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

onSelectedChange: (selected: ItemInput[]) => void
}

type OpenGestures = 'anchor-click' | 'anchor-key-press'

Copy link
Copy Markdown
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
Copy Markdown
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

@siddharthkpsiddharthkpNov 1, 2024

Copy link
Copy Markdown
MemberAuthor

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

@broccolinisoupbroccolinisoupNov 4, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
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

@siddharthkpsiddharthkpNov 1, 2024

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown

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

@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 7, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5198 November 7, 2024 15:40 Inactive
@primer-integration

Copy link
Copy Markdown

🔴 golden-jobs completed with status failure.

@github-actionsgithub-actionsBot 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
@siddharthkpsiddharthkp added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 7, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5198 November 7, 2024 17:21 Inactive
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 7, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5198 November 7, 2024 17:29 Inactive
Base automatically changed from selectpanel-use-anchored-position to mainNovember 8, 2024 08:45

Copy link
Copy Markdown
MemberAuthor

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

@siddharthkpsiddharthkp added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 8, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5198 November 8, 2024 16:37 Inactive
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Nov 8, 2024
@jonrohan
jonrohan deleted the selectpanel-modal-variant-2 branch May 9, 2025 18:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: failingChanges in this PR cause breaking changes in gh/ghstaffAuthor is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@siddharthkp@broccolinisoup