-
Notifications
You must be signed in to change notification settings - Fork 43
[Alert] LocalAlert, GlobalAlert, InfoCard and InlineMessage components
#4186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: a74c07e The changes in this PR will be included in the next version bump. 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new BaseAlert utility component designed to be shared across LocalAlert, GlobalAlert, and InfoCard components. The implementation provides a composable alert system with consistent styling and behavior patterns.
Key changes:
- New
BaseAlertcompound component with Header, Title, Content, and Close subcomponents - i18n support for announcement variant across Norwegian Bokmål, Nynorsk, and English
- Comprehensive CSS styling with support for moderate/strong intensity types and global positioning
- Typography line-height corrections for large body-short text
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
@navikt/core/react/src/util/i18n/locales/ |
Adds "announcement" translation keys for nb, nn, and en locales |
@navikt/core/react/src/alert/base-alert/ |
Complete BaseAlert component implementation with context, utils, and subcomponents |
@navikt/core/css/ |
CSS styling for BaseAlert with color variants, sizing, and darkside theme support |
@navikt/core/react/src/alert/alert.stories.tsx |
Updates legacy Alert stories title to distinguish from new BaseAlert |
Storybook demo / Chromatic📝 Changes to review: 1656150700d | 102 components | 165 stories |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| font-size: var(--ax-font-size-xlarge); | ||
| letter-spacing: -0.0013em; | ||
| line-height: var(--ax-font-line-height-large); | ||
| line-height: var(--ax-font-line-height-xlarge); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intended? 😱 If yes, it should be in a separate PR with changeset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, seems code is out of sync with Figma. Ill make a PR 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@navikt/core/react/src/alert/base-alert/close/BaseAlertClose.tsx
Outdated
Show resolved
Hide resolved
| OnlyHeader, | ||
| CloseButton, | ||
| WrappingTitle, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all possible permutations are included, but i guess it will be covered by the components that will be using BaseAlert anyways. (Maybe we don't need Chromatic stories here at all?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can consider removing the chromatic stories after merging the other alert variants.
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
…text.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
…ls.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
* 🚚 Extracted LocalAlert from #4085 * 🏷️ Rename root * 📝 Doc changes * 🐛 Add button do depdendency mapping * Update @navikt/core/react/src/alert/local-alert/close/LocalAlertClose.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Update @navikt/core/react/src/alert/local-alert/root/LocalAlertRoot.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Update @navikt/core/react/src/alert/local-alert/root/LocalAlertRoot.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Update @navikt/core/react/src/alert/local-alert/root/LocalAlertRoot.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * 🔊 LocalAlert now always an alert * 🐛 revert closebutton change --------- Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
|
|
||
| .aksel-base-alert__icon { | ||
| font-size: 1.5rem; | ||
| margin-top: var(--ax-space-4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might just be me, but I think the icon looks more centered with margin-top: 3px 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think it varies a little icon by icon 🔎
* 🚚 Extracted InfoCard from #4085 * Update .changeset/quiet-lions-serve.md Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Update @navikt/core/css/config/_mappings.js Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> --------- Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
* 🚚 Extracted GlobalAlert from #4085 * 📝 Changeset * 🏷️ Rename root * 🔊 GlobalAlert now always an alert * Apply suggestion from @HalvorHaugan Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * 📝 Add button css to global alert mappings * Apply suggestion from @HalvorHaugan Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * 📝 Docs * Apply suggestion from @HalvorHaugan Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @HalvorHaugan Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * ♻️ Remove prop-destructuring --------- Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 🚚 Move InlineMessage PR out of #4085 * 📝 Changeset * Update @navikt/core/react/src/inline-message/root/InlineMessage.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * 📝 Jsdoc update * Update @navikt/core/react/src/inline-message/root/InlineMessage.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * 🔥 Removed flex-start alignment * Update @navikt/core/react/src/inline-message/root/InlineMessage.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Update @navikt/core/react/src/inline-message/root/InlineMessage.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Update @navikt/core/react/src/inline-message/root/InlineMessage.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * Update @navikt/core/react/src/inline-message/root/InlineMessage.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * ♻️ Inline color-definitions * ♻️ Clean up css use * Update @navikt/core/react/src/inline-message/icon/InlineMessageIcon.tsx Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com> * 🔥 Remove redundant display-flex --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Halvor Haugan <83693529+HalvorHaugan@users.noreply.github.com>
LocalAlert, GlobalAlert and InfoCardLocalAlert, GlobalAlert, InfoCard and InlineMessage components
Description
Extracted from #4085
Component Checklist 📝
@navikt/core/css/config/_mappings.js)@navikt/core/css/tokens.json)@navikt/aksel-stylelint/src/deprecations.ts)@navikt/core/react/src/index.tsand@navikt/core/react/package.json)@navikt/core/css/index.css)<Component>: <gitmoji?> <Text>.E.g. "Button: ✨ Add feature xyz.")