♻️ Add prefix to CSS state-classes

This commit is contained in:
Philipp Stracker 2025-01-22 15:08:14 +01:00
parent 193e046a9a
commit 54504b7591
No known key found for this signature in database
15 changed files with 32 additions and 33 deletions

View file

@ -45,7 +45,7 @@
} }
@mixin disabled-state($control-type) { @mixin disabled-state($control-type) {
.components-#{$control-type}-control.is-disabled { .components-#{$control-type}-control.ppcp--is-disabled {
.components-#{$control-type}-control__input, .components-#{$control-type}-control__input,
.components-#{$control-type}-control__label, .components-#{$control-type}-control__label,
.components-base-control__help { .components-base-control__help {

View file

@ -48,11 +48,11 @@
@include font(16, 24, 600); @include font(16, 24, 600);
color: var(--color-text); color: var(--color-text);
.title { .ppcp--title {
margin-left: 18px; margin-left: 18px;
} }
.big { .ppcp--big {
@include font(20, 28, 400); @include font(20, 28, 400);
} }
} }
@ -79,7 +79,7 @@
} }
} }
&.is-scrolled { &.ppcp--is-scrolled {
box-shadow: 0 -1px 0 0 $color-gray-300 inset, 0 8px 8px 0 rgba(85, 93, 102, .3); box-shadow: 0 -1px 0 0 $color-gray-300 inset, 0 8px 8px 0 rgba(85, 93, 102, .3);
} }
@ -90,7 +90,7 @@
row-gap: 8px; row-gap: 8px;
white-space: nowrap; white-space: nowrap;
&--right { .ppcp-r-navigation--right {
position: absolute; position: absolute;
right: 10px; right: 10px;
z-index: 10; z-index: 10;
@ -98,12 +98,12 @@
box-shadow: -5px 0 8px var(--ppcp-color-app-bg); box-shadow: -5px 0 8px var(--ppcp-color-app-bg);
} }
&--progress-bar { .ppcp-r-navigation--progress-bar {
height: 2px; height: 2px;
} }
.components-button.is-title { .components-button.is-title {
.title { .ppcp--title {
margin-left: 4px; margin-left: 4px;
} }
} }

View file

@ -16,7 +16,7 @@
padding: 24px 16px 24px 16px; padding: 24px 16px 24px 16px;
&.selected { &.ppcp--selected {
border-color: $color-blueberry; border-color: $color-blueberry;
outline-color: $color-blueberry; outline-color: $color-blueberry;
box-shadow: $shadow-selection-box; box-shadow: $shadow-selection-box;

View file

@ -27,12 +27,12 @@
display: block; display: block;
text-transform: uppercase; text-transform: uppercase;
&.style-alt { &.ppcp--no-caps {
@include font(14, 16, 600); @include font(14, 16, 600);
text-transform: none; text-transform: none;
} }
&.style-big { &.ppcp--big {
@include font(16, 20, 600); @include font(16, 20, 600);
} }
@ -97,7 +97,7 @@
margin-left: 5px; margin-left: 5px;
} }
+ .ppcp-r-settings-block:not(.no-gap) { + .ppcp-r-settings-block:not(.ppcp--no-gap) {
margin-top: var(--block-separator-gap, 32px); margin-top: var(--block-separator-gap, 32px);
padding-top: var(--block-separator-gap, 32px); padding-top: var(--block-separator-gap, 32px);
border-top: 1px solid var(--color-gray-200); border-top: 1px solid var(--color-gray-200);

View file

@ -33,7 +33,7 @@
} }
// Select-fields have a smaller gap between the header and input field. // Select-fields have a smaller gap between the header and input field.
&.has-select { &.ppcp--has-select {
--block-header-gap: 8px; --block-header-gap: 8px;
} }
@ -58,7 +58,7 @@
margin-bottom: 28px; margin-bottom: 28px;
border-bottom: 1px solid var(--color-separators); border-bottom: 1px solid var(--color-separators);
&.no-gap, &.ppcp--no-gap,
&:last-child { &:last-child {
padding-bottom: 0; padding-bottom: 0;
margin-bottom: 0; margin-bottom: 0;

View file

@ -1,17 +1,16 @@
import classNames from 'classnames'; import classNames from 'classnames';
const Title = ( { const Title = ( { children, noCaps = false, big = false, className = '' } ) => {
children, if ( ! children ) {
altStyle = false, return null;
big = false, }
className = '',
} ) => {
const elementClasses = classNames( const elementClasses = classNames(
'ppcp-r-settings-block__title', 'ppcp-r-settings-block__title',
className, className,
{ {
'style-alt': altStyle, 'ppcp--no-caps': noCaps,
'style-big': big, 'ppcp--big': big,
} }
); );

View file

@ -19,7 +19,7 @@ const Checkbox = ( {
} }
} }
const className = classNames( { 'is-disabled': disabled } ); const className = classNames( { 'ppcp--is-disabled': disabled } );
const onChange = ( newState ) => { const onChange = ( newState ) => {
let newValue; let newValue;

View file

@ -21,7 +21,7 @@ const SelectableContent = ( {
} }
const boxClassName = classNames( 'ppcp-r-select-box', { const boxClassName = classNames( 'ppcp-r-select-box', {
selected: isSelected, 'ppcp--selected': isSelected,
} ); } );
const InputField = ( { isRadio } ) => { const InputField = ( { isRadio } ) => {

View file

@ -2,7 +2,7 @@ import classNames from 'classnames';
const SettingsBlock = ( { className, children, separatorAndGap = true } ) => { const SettingsBlock = ( { className, children, separatorAndGap = true } ) => {
const blockClassName = classNames( 'ppcp-r-settings-block', className, { const blockClassName = classNames( 'ppcp-r-settings-block', className, {
'no-gap': ! separatorAndGap, 'ppcp--no-gap': ! separatorAndGap,
} ); } );
return <div className={ blockClassName }>{ children }</div>; return <div className={ blockClassName }>{ children }</div>;

View file

@ -20,10 +20,10 @@ const TopNavigation = ( {
const { isScrolled } = useIsScrolled(); const { isScrolled } = useIsScrolled();
const className = classNames( 'ppcp-r-navigation-container', { const className = classNames( 'ppcp-r-navigation-container', {
'is-scrolled': isScrolled, 'ppcp--is-scrolled': isScrolled,
} ); } );
const titleClassName = classNames( 'title', { const titleClassName = classNames( 'ppcp--title', {
big: isMainTitle, 'ppcp--big': isMainTitle,
} ); } );
const handleTitleClick = useCallback( () => { const handleTitleClick = useCallback( () => {

View file

@ -54,8 +54,8 @@ const ConnectionButton = ( {
removeCompleteHandler, removeCompleteHandler,
} = useHandleOnboardingButton( isSandbox ); } = useHandleOnboardingButton( isSandbox );
const buttonClassName = classNames( 'ppcp-r-connection-button', className, { const buttonClassName = classNames( 'ppcp-r-connection-button', className, {
'sandbox-mode': isSandbox, 'ppcp--mode-sandbox': isSandbox,
'live-mode': ! isSandbox, 'ppcp--mode-live': ! isSandbox,
} ); } );
const environment = isSandbox ? 'sandbox' : 'production'; const environment = isSandbox ? 'sandbox' : 'production';

View file

@ -157,7 +157,7 @@ const ManualConnectionForm = () => {
value={ manualClientId } value={ manualClientId }
onChange={ setManualClientId } onChange={ setManualClientId }
className={ classNames( { className={ classNames( {
'has-error': ! clientValid, 'ppcp--has-error': ! clientValid,
} ) } } ) }
/> />
{ clientValid || ( { clientValid || (

View file

@ -14,7 +14,7 @@ const StylingSectionWithCheckboxes = ( {
onChange, onChange,
children, children,
} ) => { } ) => {
className = classNames( 'has-checkboxes', className ); className = classNames( 'ppcp--has-checkboxes', className );
return ( return (
<StylingSection <StylingSection

View file

@ -14,7 +14,7 @@ const StylingSectionWithRadiobuttons = ( {
onChange, onChange,
children, children,
} ) => { } ) => {
className = classNames( 'has-radio-buttons', className ); className = classNames( 'ppcp--has-radio-buttons', className );
return ( return (
<StylingSection <StylingSection

View file

@ -13,7 +13,7 @@ const StylingSectionWithSelect = ( {
onChange, onChange,
children, children,
} ) => { } ) => {
className = classNames( 'has-select', className ); className = classNames( 'ppcp--has-select', className );
return ( return (
<StylingSection <StylingSection