-
Notifications
You must be signed in to change notification settings - Fork 549
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(UnderlinePanels): Convert UnderlinePanels to CSS modules behind team feature flag #5357
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c5893d7
convert UnderlineItem
randall-krauskopf 1709d78
convert item list
randall-krauskopf 196eb05
additional css module migration
randall-krauskopf 485e8ff
formatting
randall-krauskopf c6e777b
fix selectors
randall-krauskopf a376d86
Migrate Loading Counter
randall-krauskopf b1f8fb1
key off of FF
randall-krauskopf 613e920
add toggle for the tabContainer
randall-krauskopf e39443e
Merge branch 'main' into underline-panels-css-modules
randall-krauskopf 4f4fee5
Merge branch 'main' into underline-panels-css-modules
randall-krauskopf e94584c
update to take additional optional dependencies
randall-krauskopf 8a1ea64
update resize observer to key off of feature flag
randall-krauskopf f2af74e
fix lint issue
randall-krauskopf b5205a2
Merge branch 'main' into underline-panels-css-modules
randall-krauskopf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": minor | ||
--- | ||
|
||
Convert UnderlinePanels to CSS modules behind feature flags |
10 changes: 10 additions & 0 deletions
10
packages/react/src/experimental/UnderlinePanels/UnderlinePanels.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.StyledUnderlineWrapper { | ||
width: 100%; | ||
overflow-x: auto; | ||
overflow-y: hidden; | ||
-webkit-overflow-scrolling: auto; | ||
} | ||
|
||
.StyledUnderlineWrapper[data-icons-visible='false'] [data-component='icon'] { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
packages/react/src/internal/components/UnderlineTabbedInterface.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
.UnderlineWrapper { | ||
display: flex; | ||
/* stylelint-disable-next-line primer/spacing */ | ||
padding-inline: var(--stack-padding-normal); | ||
justify-content: flex-start; | ||
align-items: center; | ||
|
||
/* make space for the underline */ | ||
min-height: var(--control-xlarge-size, 48px); | ||
|
||
/* using a box-shadow instead of a border to accomodate 'overflow-y: hidden' on UnderlinePanels */ | ||
/* stylelint-disable-next-line primer/box-shadow */ | ||
box-shadow: inset 0 -1px var(--borderColor-muted); | ||
} | ||
|
||
.UnderlineItemList { | ||
position: relative; | ||
display: flex; | ||
padding: 0; | ||
margin: 0; | ||
white-space: nowrap; | ||
list-style: none; | ||
align-items: center; | ||
gap: 8px; | ||
} | ||
|
||
.UnderlineItem { | ||
/* underline tab specific styles */ | ||
position: relative; | ||
display: inline-flex; | ||
font: inherit; | ||
font-size: var(--text-body-size-medium); | ||
line-height: var(--text-body-lineHeight-medium, 1.4285); | ||
color: var(--fgColor-default); | ||
text-align: center; | ||
text-decoration: none; | ||
cursor: pointer; | ||
background-color: transparent; | ||
border: 0; | ||
border-radius: var(--borderRadius-medium, var(--borderRadius-small)); | ||
|
||
/* button resets */ | ||
appearance: none; | ||
padding-inline: var(--base-size-8); | ||
padding-block: var(--base-size-6); | ||
align-items: center; | ||
|
||
@media (hover: hover) { | ||
&:hover { | ||
text-decoration: none; | ||
background-color: var(--bgColor-neutral-muted); | ||
transition: background-color 0.12s ease-out; | ||
} | ||
} | ||
} | ||
|
||
.UnderlineItem:focus { | ||
outline: 2px solid transparent; | ||
/* stylelint-disable-next-line primer/box-shadow */ | ||
box-shadow: inset 0 0 0 2px var(--fgColor-accent); | ||
|
||
/* where focus-visible is supported, remove the focus box-shadow */ | ||
&:not(:focus-visible) { | ||
box-shadow: none; | ||
} | ||
} | ||
|
||
.UnderlineItem:focus-visible { | ||
outline: 2px solid transparent; | ||
/* stylelint-disable-next-line primer/box-shadow */ | ||
box-shadow: inset 0 0 0 2px var(--fgColor-accent); | ||
} | ||
|
||
/* renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected */ | ||
.UnderlineItem [data-content]::before { | ||
display: block; | ||
height: 0; | ||
font-weight: var(--base-text-weight-semibold); | ||
white-space: nowrap; | ||
visibility: hidden; | ||
content: attr(data-content); | ||
} | ||
|
||
.UnderlineItem [data-component='icon'] { | ||
display: inline-flex; | ||
color: var(--fgColor-muted); | ||
align-items: center; | ||
margin-inline-end: var(--base-size-8); | ||
} | ||
|
||
.UnderlineItem [data-component='counter'] { | ||
margin-inline-start: var(--base-size-8); | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.UnderlineItem::after { | ||
position: absolute; | ||
right: 50%; | ||
|
||
/* TODO: see if we can simplify this positioning */ | ||
|
||
/* 48px total height / 2 (24px) + 1px */ | ||
/* stylelint-disable-next-line primer/spacing */ | ||
bottom: calc(50% - calc(var(--control-xlarge-size, var(--base-size-48)) / 2 + 1px)); | ||
width: 100%; | ||
height: 2px; | ||
content: ''; | ||
background-color: transparent; | ||
border-radius: 0; | ||
transform: translate(50%, -50%); | ||
} | ||
|
||
.UnderlineItem[aria-current]:not([aria-current='false']) [data-component='text'], | ||
.UnderlineItem[aria-selected='true'] [data-component='text'] { | ||
font-weight: var(--base-text-weight-semibold); | ||
} | ||
|
||
.UnderlineItem[aria-current]:not([aria-current='false'])::after, | ||
.UnderlineItem[aria-selected='true']::after { | ||
/* stylelint-disable-next-line primer/colors */ | ||
background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73)); | ||
|
||
@media (forced-colors: active) { | ||
/* Support for Window Force Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */ | ||
background-color: LinkText; | ||
} | ||
} | ||
|
||
.LoadingCounter { | ||
display: inline-block; | ||
width: 1.5rem; | ||
height: 1rem; /* 16px */ | ||
background-color: var(--bgColor-neutral-muted); | ||
border-color: var(--borderColor-default); | ||
/* stylelint-disable-next-line primer/borders */ | ||
border-radius: 20px; | ||
animation: loadingCounterKeyFrames 1.2s ease-in-out infinite alternate; | ||
} | ||
|
||
@keyframes loadingCounterKeyFrames { | ||
from { | ||
opacity: 1; | ||
} | ||
|
||
to { | ||
opacity: 0.2; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Needed to be able to toggle this for other dependencies than the
RefObject
. In my case recalculating the tabIcon show logic when a new component is rendered because of the FF toggle