-
Notifications
You must be signed in to change notification settings - Fork 4
chore: use new breakpoint helpers in core components #687
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,13 +36,12 @@ export const ElBottomBarItemIcon = styled.span` | |
| position: relative; | ||
|
|
||
| color: var(--comp-navigation-colour-icon-bottom_bar-default); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: small scout. Having the font-size defined outside the |
||
| font-size: var(--icon_size-l); | ||
| width: var(--icon_size-l); | ||
| height: var(--icon_size-l); | ||
|
|
||
| ${ElDeprecatedIcon} { | ||
| color: inherit; | ||
| font-size: inherit; | ||
| font-size: var(--icon_size-l); | ||
| width: inherit; | ||
| height: inherit; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { isTablet } from '#src/styles/deprecated-media' | ||
| import { isWidthAtOrAbove, isWidthBelow } from '#src/utils/breakpoints' | ||
| import { styled } from '@linaria/react' | ||
|
|
||
| export const ElBottomBarContainer = styled.div` | ||
|
|
@@ -10,16 +10,20 @@ export const ElBottomBarContainer = styled.div` | |
| container-type: inline-size; | ||
|
|
||
| display: block; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: because the bottom bar currently relies on an ancestral container that may or may not be present in the DOM, we keep the media queries as a backup. |
||
| @supports not (container-type: inline-size) { | ||
| ${isTablet} { | ||
| display: none; | ||
| } | ||
|
|
||
| @media screen and ${isWidthAtOrAbove('SM')} { | ||
| display: none; | ||
| } | ||
|
|
||
| @container ${isWidthAtOrAbove('SM')} { | ||
| display: none; | ||
| } | ||
| @supports (container-type: inline-size) { | ||
| /* NOTE: This is equivalent to the SM breakpoint */ | ||
| @container (width >= 768px) { | ||
| display: none; | ||
| } | ||
|
|
||
| /* NOTE: This container query will override the default media query behaviour above if there's | ||
| * an ancestor is a container. If there's no ancestral container, the media query will behave | ||
| * as defined above. */ | ||
| @container ${isWidthBelow('SM')} { | ||
| display: block; | ||
| } | ||
| ` | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { styled } from '@linaria/react' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: a few changes like this throughout the PR. Replacing the deprecated media helpers with the new breakpoint conditions. |
||
| import { isMobile } from '#src/styles/deprecated-media' | ||
| import { isWidthAtOrAbove, isWidthBelow } from '#src/utils/breakpoints' | ||
|
|
||
| interface ElBreadcrumbsProps { | ||
| 'data-overflow'?: 'scroll' | 'truncate' | ||
|
|
@@ -8,12 +8,27 @@ interface ElBreadcrumbsProps { | |
| export const ElBreadcrumbs = styled.nav<ElBreadcrumbsProps>` | ||
| width: 100%; | ||
|
|
||
| ${isMobile} { | ||
| /* NOTE: Media and container queries come before data-overflow attribute styles to allow | ||
| * the latter to take precedence */ | ||
| @media screen and ${isWidthBelow('SM')} { | ||
| /* NOTE: This is generally considered bad practice */ | ||
| scrollbar-width: none; | ||
| overflow-x: auto; | ||
| } | ||
|
|
||
| @container ${isWidthBelow('SM')} { | ||
| scrollbar-width: none; | ||
| overflow-x: auto; | ||
| } | ||
|
|
||
| /* NOTE: This container query will override the default media query behaviour above if there's | ||
| * an ancestor is a container. If there's no ancestral container, the media query will behave | ||
| * as defined above. */ | ||
| @container ${isWidthAtOrAbove('SM')} { | ||
| scrollbar-width: initial; | ||
| overflow-x: initial; | ||
| } | ||
|
|
||
| &[data-overflow='scroll'] { | ||
| scrollbar-width: none; | ||
| overflow-x: auto; | ||
|
|
@@ -34,10 +49,23 @@ export const ElBreadcrumbsList = styled.ul` | |
|
|
||
| width: 100%; | ||
|
|
||
| ${isMobile} { | ||
| /* NOTE: Media and container queries come before data-overflow attribute styles to allow | ||
| * the latter to take precedence */ | ||
| @media screen and ${isWidthBelow('SM')} { | ||
| width: max-content; | ||
| } | ||
|
|
||
| @container ${isWidthBelow('SM')} { | ||
| width: max-content; | ||
| } | ||
|
|
||
| /* NOTE: This container query will override the default media query behaviour above if there's | ||
| * an ancestor is a container. If there's no ancestral container, the media query will behave | ||
| * as defined above. */ | ||
| @container ${isWidthAtOrAbove('SM')} { | ||
| width: 100%; | ||
| } | ||
|
|
||
| [data-overflow='truncate'] > & { | ||
| width: 100%; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const TOP_BAR_CONTAINER_NAME = '--top-bar-container' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: extracted this container name to a constants.ts file like we've done for drawer and folder tabs et al. |
||
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.
note: ensuring the storybook docs demo container query behaviour