Skip to content
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

Try: React 19 <link /> for components #66781

Draft
wants to merge 3 commits into
base: try/react-19-beta
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/components/src/button-group/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ function UnforwardedButtonGroup(
const classes = clsx( 'components-button-group', className );

return (
<div ref={ ref } role="group" className={ classes } { ...restProps } />
<>
<link
rel="stylesheet"
data-precedence="low"
href="../wp-content/plugins/gutenberg/packages/components/src/button-group/style.css"
/>
<div
ref={ ref }
role="group"
className={ classes }
{ ...restProps }
/>
</>
);
}

Expand Down
34 changes: 34 additions & 0 deletions packages/components/src/button-group/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.components-button-group {
display: inline-block;
}
.components-button-group .components-button {
border-radius: 0;
display: inline-flex;
color: $gray-900;
box-shadow: inset 0 0 0 $border-width $gray-900;
}

.components-button-group .components-button + .components-button {
margin-left: -1px;
}

.components-button-group .components-button:first-child {
border-radius: $radius-small 0 0 $radius-small;
}

.components-button-group .components-button:last-child {
border-radius: 0 $radius-small $radius-small 0;
}

// The focused button should be elevated so the focus ring isn't cropped,
// as should the active button, because it has a different border color.
.components-button-group .components-button:focus,
.components-button-group .components-button.is-primary {
position: relative;
z-index: z-index(".components-button {:focus or .is-primary}");
}

// The active button should look pressed.
.components-button-group .components-button.is-primary {
box-shadow: inset 0 0 0 $border-width $gray-900;
}
35 changes: 0 additions & 35 deletions packages/components/src/button-group/style.scss

This file was deleted.

1 change: 0 additions & 1 deletion packages/components/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// Components
@import "./animate/style.scss";
@import "./autocomplete/style.scss";
@import "./button-group/style.scss";
@import "./button/style.scss";
@import "./checkbox-control/style.scss";
@import "./circular-option-picker/style.scss";
Expand Down
Loading