-
Notifications
You must be signed in to change notification settings - Fork 76
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
feat(alert): make component responsive #7755
Conversation
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.
👍 💯 🥇
container: responsive-container / inline-size; | ||
border-radius: var(--calcite-border-radius); | ||
border-block-start: 0 solid transparent; | ||
border-inline: 1px solid var(--calcite-ui-border-3); |
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.
I wonder if these border px values should come from a token?
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.
I stored them in a sass variable for now to DRY things up w/o adding a CSS prop.
border-inline: 1px solid var(--calcite-ui-border-3); | ||
border-block-end: 1px solid var(--calcite-ui-border-3); | ||
inline-size: var(--calcite-alert-width); | ||
max-inline-size: calc(100% - (var(--calcite-alert-edge-distance) * 2 + 2px)); |
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.
What is the 2px
here from? can that come from a token?
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.
Agreed on using internal CSS props or Sass vars for these. @macandcheese could you help us out with this?
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.
Hm, this is an older one, maybe to compensate for the 1px border on either side? May not be necessary anymore.
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.
Doesn't seem to be necessary. Removed!
w-full | ||
overflow-hidden; | ||
inset-inline: 0; | ||
inset-block-start: -2px; |
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.
For these 2px values maybe a sass variable or token would be nice
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.
Maybe we can do this in a follow-up PR. I'm not entirely sure if all 2px values represent the same thing. 🤔
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.
Yep sounds good 👍
<calcite-icon | ||
flipRtl={this.iconFlipRtl} | ||
icon={icon} | ||
scale={this.scale === "l" ? "m" : "s"} |
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.
Maybe a function for setting this scale value? This logic appears twice.
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.
I like the idea of having a util for internal icon scale adjustment. Especially, since it's sprinkled across many components. These seem to be the only exceptions I found:
calcite-design-system/packages/calcite-components/src/components/popover/popover.tsx
Line 545 in 8a575e4
<calcite-icon icon="x" scale={this.scale === "l" ? "m" : this.scale} /> calcite-design-system/packages/calcite-components/src/components/modal/modal.tsx
Line 300 in 796bf90
this.scale === "s" ? "s" : this.scale === "m" ? "m" : this.scale === "l" ? "l" : null
@ashetland @SkyeSeitz All internal icons scales should be following this (m
icon for scale="l"
and s
icon for scale="s"
+ scale="m"
) , right?
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.
Yep, that's correct.
@macandcheese @ashetland @SkyeSeitz Could you review the visual changes? 🙇 |
🤖 I have created a release *beep* *boop* --- <details><summary>@esri/calcite-components: 1.9.0</summary> ## [1.9.0](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected]) (2023-10-03) ### Features * **action-group:** Add css custom properties to define gap and padding when layout is "grid" ([#7763](#7763)) ([b9bd0de](b9bd0de)) * **action-menu:** Add appearance property to configure trigger appearance ([#7867](#7867)) ([36ceaf1](36ceaf1)) * **alert:** Make component responsive ([#7755](#7755)) ([66222b5](66222b5)) * **block, input-time-picker, notice:** Adds `open`, `close`, `beforeOpen`, and `beforeClose` events for consistent event handling ([#7494](#7494)) ([04ce758](04ce758)) * **checkbox:** Add WCAG AA recommended minimum 24px square hotspot optimized for touch users ([#7773](#7773)) ([f13e2c4](f13e2c4)) * **flow, flow-item:** Allow calciteFlowItemBack event to be cancelled ([#7855](#7855)) ([b74b4df](b74b4df)) * **input-date-picker, input-time-picker:** Add status property ([#7915](#7915)) ([4d53346](4d53346)) * **input-time-zone:** Add max-items support ([#7705](#7705)) ([c698c27](c698c27)) * **input-time-zone:** Add time zone offset and name mode ([#7913](#7913)) ([80bd6ae](80bd6ae)) * **list:** Add newIndex and oldIndex event details to calciteListOrderChange event ([#7874](#7874)) ([0d5cc20](0d5cc20)) * **pagination:** Enable responsive layout ([#7722](#7722)) ([933a910](933a910)) * **panel, flow-item:** Add support for collapsing content ([#7857](#7857)) ([855754d](855754d)) ### Bug Fixes * **action-bar:** Improve overflowing horizontal actions. ([#7877](#7877)) ([52f2d2a](52f2d2a)) * **action-bar:** Overflow actions when overflowActionsDisabled is set to false ([#7873](#7873)) ([3dcceb0](3dcceb0)) * **action-menu:** Update active selection to not use the action's active property ([#7911](#7911)) ([50f85f1](50f85f1)) * **alert:** Regression fix to restore `calciteAlertBeforeOpen` and `calciteAlertOpen` event emitting ([#7767](#7767)) ([6bbae35](6bbae35)) * **button:** Provides context for AT users when used as reference element for collapsible content ([#7658](#7658)) ([50cb3a6](50cb3a6)) * **combobox:** Clears input value on blur ([#7721](#7721)) ([e04cc4e](e04cc4e)) * **combobox:** Fix filtering to avoid showing unrelated items ([#7704](#7704)) ([b6d32f3](b6d32f3)) * **dropdown-group:** Set selectionMode on slotted dropdown-item children ([#7897](#7897)) ([aa0731a](aa0731a)) * **dropdown:** Support dispatching enter key event on dropdown trigger ([#7752](#7752)) ([ba92463](ba92463)) * **select:** Allow setting an option value to an empty string ([#7769](#7769)) ([adca6ec](adca6ec)) * **stepper:** Improves AT Users experience with screen readers ([#7691](#7691)) ([071dec7](071dec7)) * **tab-nav:** Update indicator position when tab icon changes ([#7768](#7768)) ([cb877b3](cb877b3)) * **table:** Fix selection display in RTL ([#7907](#7907)) ([b4c8508](b4c8508)) * **tree:** Avoid modifying selected items for "none" selection-mode ([#7904](#7904)) ([0bd4a12](0bd4a12)) * **tree:** Fix tree keyboard selection issue ([#7908](#7908)) ([53d6c12](53d6c12)) * **tree:** Update tree selection per design spec ([#7852](#7852)) ([06b3594](06b3594)) </details> <details><summary>@esri/calcite-components-react: 1.9.0</summary> ## [1.9.0](https://github.com/Esri/calcite-design-system/compare/@esri/[email protected]...@esri/[email protected]) (2023-10-03) ### Miscellaneous Chores * **@esri/calcite-components-react:** Synchronize undefined versions ### Dependencies * The following workspace dependencies were updated * dependencies * @esri/calcite-components bumped from ^1.9.0-next.18 to ^1.9.0 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…7973) # Adopted #7935 cc @alhridoy --- **Related Issue:** #7765 ## Summary This pull request extracts the logic for adjusting internal icon scales into a separate utility function. This function is now used across all components, making the code DRYer and easier to maintain. ## Changes - Created a new utility function `adjustIconScale` in `iconScaleAdjuster.ts`. - Replaced inline logic for adjusting icon scales with calls to `adjustIconScale` in all relevant components. ## Testing - All unit tests pass. - Manual testing in the browser confirms that icons still display correctly at all scales. This change stems from issue #7755 and is expected to make the codebase easier to maintain by reducing repetition of this logic. --------- Co-authored-by: Al-Iqram Elahee <[email protected]>
**Related Issue:** N/A ## Summary Rolls back responsiveness (#7755) in favor of upcoming alert stack UX (#2835). See #7921 (comment) for more info.
**Related Issue:** N/A Rolls back responsiveness (#7755) in favor of upcoming alert stack UX (#2835). See #7921 (comment) for more info.
**Related Issue:** N/A Rolls back responsiveness (#7755) in favor of upcoming alert stack UX (#2835). See #7921 (comment) for more info.
**Related Issue:** N/A Rolls back responsiveness (#7755) in favor of upcoming alert stack UX (#2835). See #7921 (comment) for more info.
Related Issue: #6673
Summary
Updates alert to be responsive per the design spec.
Additional changes
alert
prefix is no longer necessary)no-descending-specificity
stylelint rulerequestedIcon
is now computed at render time to simplify component