Skip to content

Commit

Permalink
Allow configuration of font weight of links inside Alert #577
Browse files Browse the repository at this point in the history
Default font weight of links is now set to "regular" so it is
consistent with other links in React UI. However, it remains
configurable because of downstream project requirements.
  • Loading branch information
adamkudrna committed Dec 2, 2024
1 parent bac1e21 commit 78aacd9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/components/Alert/Alert.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
line-height: settings.$line-height;
}

.message :is(a, strong) {
.message a {
font-weight: theme.$link-font-weight;
}

.message strong {
font-weight: theme.$emphasis-font-weight;
}

Expand Down
17 changes: 9 additions & 8 deletions src/components/Alert/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,15 @@ helps to improve its accessibility.

### Common Theming Options

| Custom Property | Description |
|------------------------------------------------------|--------------------------------------------------------------|
| `--rui-Alert__padding` | Padding between border and message |
| `--rui-Alert__font-weight` | Message font weight |
| `--rui-Alert__border-width` | Border width |
| `--rui-Alert__border-radius` | Corner radius |
| `--rui-Alert__emphasis__font-weight` | Font weight of text emphasised with `<strong>` |
| `--rui-Alert__stripe__width` | Width of the border at the start of the Alert |
| Custom Property | Description |
|--------------------------------------|------------------------------------------------|
| `--rui-Alert__padding` | Padding between border and message |
| `--rui-Alert__font-weight` | Message font weight |
| `--rui-Alert__border-width` | Border width |
| `--rui-Alert__border-radius` | Corner radius |
| `--rui-Alert__emphasis__font-weight` | Font weight of text emphasised with `<strong>` |
| `--rui-Alert__link__font-weight` | Font weight of links inside Alert |
| `--rui-Alert__stripe__width` | Width of the border at the start of the Alert |

### Theming Variants

Expand Down
1 change: 1 addition & 0 deletions src/components/Alert/_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ $font-weight: var(--rui-Alert__font-weight);
$border-width: var(--rui-Alert__border-width);
$border-radius: var(--rui-Alert__border-radius);
$emphasis-font-weight: var(--rui-Alert__emphasis__font-weight);
$link-font-weight: var(--rui-Alert__link__font-weight);
$stripe-width: var(--rui-Alert__stripe__width);
1 change: 1 addition & 0 deletions src/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
--rui-Alert__border-width: var(--rui-dimension-border-width-1);
--rui-Alert__border-radius: var(--rui-dimension-radius-2);
--rui-Alert__emphasis__font-weight: var(--rui-font-weight-bold);
--rui-Alert__link__font-weight: var(--rui-font-weight-regular);
--rui-Alert__stripe__width: var(--rui-dimension-border-width-1);

// Alert: variant: success
Expand Down

0 comments on commit 78aacd9

Please sign in to comment.