-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- ☝️How to write a good PR title: - Prefix it with [ComponentName] (if applicable), for example: [Button] - Start with a verb, for example: Add, Delete, Improve, Fix… - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ### WHY are these changes introduced? Fixes #10995 Fixes #11006 <!-- Context about the problem that’s being addressed. --> ### WHAT is this pull request doing? Fixes the `buttonFrom` util not mapping the action parameter's boolean variant properties to `variant` and `tone`. | Before | [After]() | |--------|--------| | <img width="665" alt="Screenshot 2023-10-25 at 4 03 52 PM" src="https://github.com/Shopify/polaris/assets/18447883/a3dfa184-c0ce-465c-97ea-32e5f6cfff86">| <img width="671" alt="Screenshot 2023-10-25 at 4 02 41 PM" src="https://github.com/Shopify/polaris/assets/18447883/1b85d1ed-4804-4776-a168-a551ff298102">| ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [x] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
- Loading branch information
Showing
7 changed files
with
239 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/polaris': patch | ||
--- | ||
|
||
Fixed `buttonFrom` utility function not mapping boolean variant properties to `variant` and `tone` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
278 changes: 139 additions & 139 deletions
278
polaris.shopify.com/content/whats-new/version-11-tokens.md
Large diffs are not rendered by default.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
polaris.shopify.com/pages/examples/modal-with-destructive-primary-action.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {Button, Modal, Frame} from '@shopify/polaris'; | ||
import {useState, useCallback} from 'react'; | ||
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper'; | ||
|
||
function ModalWithDestructivePrimaryActionExample() { | ||
const [active, setActive] = useState(true); | ||
|
||
const toggleModal = useCallback(() => setActive((active) => !active), []); | ||
|
||
const activator = <Button onClick={toggleModal}>Open</Button>; | ||
|
||
return ( | ||
<Frame> | ||
<div style={{height: '500px'}}> | ||
<Modal | ||
activator={activator} | ||
open={active} | ||
onClose={toggleModal} | ||
title="Discard all unsaved changes" | ||
primaryAction={{ | ||
destructive: true, | ||
content: 'Discard changes', | ||
onAction: toggleModal, | ||
}} | ||
secondaryActions={[ | ||
{ | ||
content: 'Continue editing', | ||
onAction: toggleModal, | ||
}, | ||
]} | ||
> | ||
<Modal.Section> | ||
If you discard changes, you’ll delete any edits you made since you | ||
last saved. | ||
</Modal.Section> | ||
</Modal> | ||
</div> | ||
</Frame> | ||
); | ||
} | ||
|
||
export default withPolarisExample(ModalWithDestructivePrimaryActionExample); |