Uh oh!
There was an error while loading. Please reload this page.
Button v2: Fix icon positions for block buttons - #1733
Conversation
🦋 Changeset detectedLatest commit: 601226b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
| gridArea: 'trailingIcon' | ||
| }, | ||
| '[data-component="leadingIcon"] + [data-component="text"]': { | ||
| textAlign: 'left' |
There was a problem hiding this comment.
Not sure if this leftAlign is required tbh.
There was a problem hiding this comment.
fair, how do we make it easier for the user to override this with left align?
this would be the override, not sure if requires knowing the internal details?
<ButtonleadingIcon={EyeIcon}trailingIcon={TriangleDownIcon}sx={{'[data-component="text"]': {textAlign: 'left'}}}>
Watch
</Button>There was a problem hiding this comment.
True :( This is where composite components would be handy. Maybe such an override usecase means we want to open up the API?
There was a problem hiding this comment.
If we go with the center-aligned approach I recommended, we can get rid of this style block.
46ab6f3 to
601226bCompare
Sorry, my PR was a bit rushed. This is what I'm proposing: (will make changes to the PR if we like the proposal) cc @ashygee |
mperrotti
left a comment
There was a problem hiding this comment.
I think left-aligning the leadingVisual and label when we have a trailingVisual is a bit strange. It will especially look weird if we have two stacked full-width buttons where 1 has left-aligned text, and the other has center-aligned text.
I think the "current" column of the mock you posted is what we want.
Curious to hear what @ashygee thinks
| ...getBaseStyles(theme), | ||
| display: 'grid', | ||
| gridTemplateAreas: '"leadingIcon text trailingIcon"', | ||
| gridTemplateColumns: 'min-content 1fr min-content', |
There was a problem hiding this comment.
If we decide to go with the center-aligned approach I recommended, we can remove this style and just add justify-content: center;
siddharthkp
commented
Dec 17, 2021
For context, this is the pattern I'm chasing: This is what the code looks like for positioning it correctly (ignoring the hover state for now): To be able to override it correctly, you have to know some implementation details about it, which feels wrong :( <NewButtonvariant="invisible"trailingIcon={GearIcon}sx={{width: "100%",justifyContent: "space-between",gridTemplateAreas: '"text trailingIcon"'}}> |
pksjce
commented
Dec 21, 2021
@mperrotti - If there is a product use case then I think we should work on supporting the new mocks. |
pksjce
commented
Dec 22, 2021
Since @ashygee is on holidays, I was wondering if @vdepizzol could help us with this? |
pksjce
commented
Dec 22, 2021
siddharthkp
commented
Dec 22, 2021
Context:
only issues-app for now I think, but feels like a generic use case, we can also decide we want this alignment to be an override in the product instead of supporting it out of the box.
That could work!
That would be nice. This can also wait, it's not a december problem :) |
* add template columns and text align for text * only align left if there's a leading Icon * add changeset * add warning for multiple selection with DropdownMenu * wip: stories * use leadingIcon with #1733 * add form to story example * use menuitemradio + aria-checked * fix types for selectionProperty * it's not a property, it's an attribute * placeholder in story * story with placeholder * oops, don't want forms to submit! * selected milestone can be undefined! * update snapshots * Add story for controlled menu and external anchor * add tests! * export DropdownMenu2 as draft * default to selectionVariant single for DropdownMenu * dont need axe anymore * update octicons for docs * add docs for dropdown menu v2 * remove changes from #1733 * update snapshots for removed button * link to button2 docs * add changeset * lol everybody makes mistakes * oof! * Use active voice in component description Co-authored-by: Rez <rezrah@github.com> * update snapshosts with main * just Props Co-authored-by: Rez <rezrah@github.com> * Use PropsTable * simplify code example a bit * make controlled state more clear * keep lockfile version 1 * remove unrelated change Co-authored-by: Rez <rezrah@github.com>
mperrotti
commented
Jan 25, 2022
This came up during a Primer design pattern working session, and I like how @langermank decided to handle it Storybook preview deployment link: https://primer-css-goebhg4xi-primer.vercel.app/css/storybook?path=/story/explorations--example-sheet |
siddharthkp
commented
Feb 23, 2022
This isn't the direction in which we're going ✌️ |






With a block button, the icon and text alignment is a bit strange
Screenshots
Please provide before/after screenshots for any visual changes
The chromatic tests (see checks below) show that there are no visual regressions :)
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.