diff --git a/UNRELEASED.md b/UNRELEASED.md index 0f83c986059..0b8f4c99e1f 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -11,6 +11,7 @@ Use [the changelog guidelines](/documentation/Versioning%20and%20changelog.md) t ### Bug fixes - Fixed `segmented` `ButtonGroup` misaligning icon only buttons when grouped with text only buttons ([#4079](https://github.com/Shopify/polaris-react/issues/4079)) +- Added missing styles for `destructive` `Page` `secondaryActions` ([#4647](https://github.com/Shopify/polaris-react/pull/4647)) ### Documentation diff --git a/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.scss b/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.scss index 1c74b74eae7..10723d2dc9c 100644 --- a/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.scss +++ b/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.scss @@ -27,4 +27,22 @@ $button-spacing: rem(12px); @include focus-ring($border-width: rem(0)); } } + + &.destructive { + a, + button { + @include recolor-icon(var(--p-icon-critical)); + color: var(--p-interactive-critical); + + // stylelint-disable-next-line selector-max-specificity + &:hover { + background-color: var(--p-surface-critical-subdued-hovered) !important; + } + + // stylelint-disable selector-max-specificity + &:active { + background-color: var(--p-surface-critical-subdued-pressed) !important; + } + } + } } diff --git a/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.tsx b/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.tsx index c56adc68fe5..d935d13fe5e 100644 --- a/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.tsx +++ b/src/components/ActionMenu/components/SecondaryAction/SecondaryAction.tsx @@ -1,5 +1,6 @@ import React, {useEffect, useRef} from 'react'; +import {classNames} from '../../../../utilities/css'; import {Button} from '../../../Button'; import type {ButtonProps} from '../../../Button'; @@ -12,6 +13,7 @@ interface SecondaryAction extends ButtonProps { export function SecondaryAction({ children, + destructive, onAction, getOffsetWidth, ...rest @@ -25,7 +27,13 @@ export function SecondaryAction({ }, [getOffsetWidth]); return ( - + diff --git a/src/components/Page/README.md b/src/components/Page/README.md index 354e23474ca..37d40eefd7f 100644 --- a/src/components/Page/README.md +++ b/src/components/Page/README.md @@ -258,6 +258,21 @@ Use when a primary action functions better as part of the page content instead o ``` +### Page with destructive secondary action + + + +Used to visually indicate that the secondary page action is destructive. + +```jsx + +

Page content

+
+``` + ### Page with subtitle