Skip to content

Commit 973f40a

Browse files
authored
InlineAlert: support Heading instead of Header (#4834)
1 parent 22ded33 commit 973f40a

File tree

5 files changed

+30
-26
lines changed

5 files changed

+30
-26
lines changed

packages/@adobe/spectrum-css-temp/components/inlinealert/index.css

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ governing permissions and limitations under the License.
1616
/* Font */
1717
--spectrum-inlinealert-heading-font-weight: var(--spectrum-alias-heading-text-font-weight-regular);
1818
--spectrum-inlinealert-heading-font-style: var(--spectrum-global-font-style-regular);
19-
--spectrum-inlinealert-heading-font-size: var(--spectrum-global-dimension-font-size-100);
19+
--spectrum-inlinealert-heading-font-size: var(--spectrum-alias-heading-xxs-text-size);
2020
--spectrum-inlinealert-heading-line-height: var(--spectrum-alias-heading-text-line-height);
2121

2222
--spectrum-inlinealert-content-font-weight: var(--spectrum-alias-body-text-font-weight);
@@ -29,17 +29,17 @@ governing permissions and limitations under the License.
2929
--spectrum-inlinealert-border-radius: var(--spectrum-border-radius);
3030
--spectrum-inlinealert-icon-size: var(--spectrum-global-dimension-size-225);
3131
--spectrum-inlinealert-min-inline-size: 240px;
32-
--spectrum-inlinealert-header-min-block-size: var(--spectrum-global-dimension-size-250);
32+
--spectrum-inlinealert-heading-min-block-size: var(--spectrum-global-dimension-size-250);
3333

3434
/* Spacing */
3535
--spectrum-inlinealert-spacing-edge-to-text: var(--spectrum-global-dimension-static-size-300);
36-
--spectrum-inlinealert-spacing-header-to-icon: var(--spectrum-global-dimension-static-size-300);
37-
--spectrum-inlinealert-spacing-header-content-button: var(--spectrum-global-dimension-static-size-200);
36+
--spectrum-inlinealert-spacing-heading-to-icon: var(--spectrum-global-dimension-static-size-300);
37+
--spectrum-inlinealert-spacing-heading-content-button: var(--spectrum-global-dimension-static-size-200);
3838

3939
/* Color */
4040
--spectrum-inlinealert-background-color: var(--spectrum-global-color-gray-50);
4141
--spectrum-inlinealert-border-and-icon-color: var(--spectrum-gray-visual-color);
42-
--spectrum-inlinealert-header-color: var(--spectrum-alias-heading-text-color);
42+
--spectrum-inlinealert-heading-color: var(--spectrum-alias-heading-text-color);
4343
--spectrum-inlinealert-content-color: var(--spectrum-alias-text-color);
4444
--spectrum-inlinealert-border-and-icon-color-info: var(--spectrum-informative-visual-color);
4545
--spectrum-inlinealert-border-and-icon-color-positive: var(--spectrum-positive-visual-color);
@@ -67,16 +67,16 @@ governing permissions and limitations under the License.
6767
display: grid;
6868
grid-template-columns: 1fr auto;
6969
grid-template-rows: auto auto auto;
70-
column-gap: var(--spectrum-inlinealert-spacing-header-to-icon);
70+
column-gap: var(--spectrum-inlinealert-spacing-heading-to-icon);
7171
grid-template-areas:
72-
"header icon "
72+
"heading icon "
7373
"content content";
7474
width: 100%;
7575
}
7676

7777
.spectrum-InLineAlert.spectrum-InLineAlert--neutral .spectrum-InLineAlert-grid {
7878
column-gap: 0;
79-
grid-template-areas: "header" "content";
79+
grid-template-areas: "heading" "content";
8080
}
8181

8282
.spectrum-InLineAlert-icon {
@@ -86,24 +86,26 @@ governing permissions and limitations under the License.
8686
block-size: var(--spectrum-inlinealert-icon-size);
8787
}
8888

89-
.spectrum-InLineAlert-header {
89+
.spectrum-InLineAlert-heading {
9090
display: block;
91-
grid-area: header;
91+
grid-area: heading;
9292

9393
font-weight: var(--spectrum-inlinealert-heading-font-weight);
9494
font-style: var(--spectrum-inlinealert-heading-font-style);
9595
font-size: var(--spectrum-inlinealert-heading-font-size);
9696
line-height: var(--spectrum-inlinealert-heading-line-height);
9797
text-transform: none;
9898

99-
min-block-size: var(--spectrum-inlinealert-header-min-block-size);
99+
min-block-size: var(--spectrum-inlinealert-heading-min-block-size);
100+
margin-block-start: 0;
101+
margin-block-end: 0;
100102
}
101103

102104
.spectrum-InLineAlert-content {
103105
display: block;
104106
grid-area: content;
105107

106-
margin-block-start: var(--spectrum-inlinealert-spacing-header-content-button);
108+
margin-block-start: var(--spectrum-inlinealert-spacing-heading-content-button);
107109
margin-block-end: 0;
108110
margin-inline-start: 0;
109111
margin-inline-end: 0;

packages/@adobe/spectrum-css-temp/components/inlinealert/skin.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ governing permissions and limitations under the License.
1313
@media (forced-colors: active) {
1414
.spectrum-InLineAlert {
1515
--highcontrast-inlinealert-background-color: Background;
16-
--highcontrast-inlinealert-header-color: CanvasText;
16+
--highcontrast-inlinealert-heading-color: CanvasText;
1717
--highcontrast-inlinealert-content-color: CanvasText;
1818
--highcontrast-inlinealert-border-and-icon-color: ButtonBorder;
1919
}
@@ -24,8 +24,8 @@ governing permissions and limitations under the License.
2424
border-color:var(--highcontrast-inlinealert-border-and-icon-color, var(--spectrum-inlinealert-border-and-icon-color));
2525
}
2626

27-
.spectrum-InLineAlert-header {
28-
color:var(--highcontrast-inlinealert-header-color, var(--spectrum-inlinealert-header-color));
27+
.spectrum-InLineAlert-heading {
28+
color:var(--highcontrast-inlinealert-heading-color, var(--spectrum-inlinealert-heading-color));
2929
}
3030

3131
.spectrum-InLineAlert-content {

packages/@react-spectrum/inlinealert/docs/InlineAlert.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import packageData from '@react-spectrum/inlinealert/package.json';
1616

1717
```jsx import
1818
import {InlineAlert} from '@react-spectrum/inlinealert';
19-
import {Header, Content} from '@adobe/react-spectrum';
19+
import {Content} from '@adobe/react-spectrum';
20+
import {Heading} from '@react-spectrum/text';
2021
```
2122

2223
---
@@ -39,7 +40,7 @@ keywords: [inline alert, alert]
3940

4041
```tsx example
4142
<InlineAlert>
42-
<Header>Payment Information</Header>
43+
<Heading>Payment Information</Heading>
4344
<Content>Enter your billing address, shipping address, and payment method to complete your purchase.</Content>
4445
</InlineAlert>
4546
```
@@ -50,7 +51,7 @@ Inline alerts contain a title and body. They also include an icon for non-neutra
5051

5152
```tsx example
5253
<InlineAlert variant="positive">
53-
<Header>Payment Information</Header>
54+
<Heading>Payment Information</Heading>
5455
<Content>Enter your billing address, shipping address, and payment method to complete your purchase.</Content>
5556
</InlineAlert>
5657
```
@@ -80,7 +81,7 @@ The default variant is neutral, and should be used when the message is neutral i
8081

8182
```tsx example
8283
<InlineAlert variant="info">
83-
<Header>Accepted Payment Methods</Header>
84+
<Heading>Accepted Payment Methods</Heading>
8485
<Content>Only major credit cards are accepted for payment. Direct debit is currently unavailable.</Content>
8586
</InlineAlert>
8687
```
@@ -89,7 +90,7 @@ The default variant is neutral, and should be used when the message is neutral i
8990

9091
```tsx example
9192
<InlineAlert variant="positive">
92-
<Header>Purchase completed</Header>
93+
<Heading>Purchase completed</Heading>
9394
<Content>You'll get a confirmation email with your order details shortly.</Content>
9495
</InlineAlert>
9596
```
@@ -98,7 +99,7 @@ The default variant is neutral, and should be used when the message is neutral i
9899

99100
```tsx example
100101
<InlineAlert variant="notice">
101-
<Header>Update payment information</Header>
102+
<Heading>Update payment information</Heading>
102103
<Content>The saved credit card for your account has expired. Update your payment information to complete the purchase.</Content>
103104
</InlineAlert>
104105
```
@@ -107,7 +108,7 @@ The default variant is neutral, and should be used when the message is neutral i
107108

108109
```tsx example
109110
<InlineAlert variant="negative">
110-
<Header>Unable to process payment</Header>
111+
<Heading>Unable to process payment</Heading>
111112
<Content>There was an error processing your payment. Please check that your credit card information is correct, then try again.</Content>
112113
</InlineAlert>
113114
```

packages/@react-spectrum/inlinealert/src/InlineAlert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function InlineAlert(props: SpectrumInlineAlertProps, ref: DOMRef<HTMLDivElement
4444
let domRef = useDOMRef(ref);
4545

4646
let slots = {
47-
header: {UNSAFE_className: styles['spectrum-InLineAlert-header']},
47+
heading: {UNSAFE_className: styles['spectrum-InLineAlert-heading']},
4848
content: {UNSAFE_className: styles['spectrum-InLineAlert-content']}
4949
};
5050

packages/@react-spectrum/inlinealert/stories/InlineAlert.stories.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
*/
1212

1313
import {Button} from '@react-spectrum/button';
14-
import {Content, Header} from '@react-spectrum/view';
14+
import {Content} from '@react-spectrum/view';
15+
import {Heading} from '@react-spectrum/text';
1516
import {InlineAlert} from '../';
1617
import {Meta} from '@storybook/react';
1718
import React, {useState} from 'react';
@@ -45,7 +46,7 @@ export default meta;
4546
export const Default = {
4647
render: (args) => (
4748
<InlineAlert {...args}>
48-
<Header>{args.title}</Header>
49+
<Heading>{args.title}</Heading>
4950
<Content>{args.content}</Content>
5051
</InlineAlert>
5152
)
@@ -63,7 +64,7 @@ function DynamicExample(args) {
6364
<Button variant="primary" onPress={() => setShown(!shown)}>{shown ? 'Hide Alert' : 'Show Alert'}</Button>
6465
{shown &&
6566
<InlineAlert {...args}>
66-
<Header>{args.title}</Header>
67+
<Heading>{args.title}</Heading>
6768
<Content>{args.content}</Content>
6869
</InlineAlert>
6970
}

0 commit comments

Comments
 (0)