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

[Controls] Fix styles #192319

Merged
merged 9 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.controlPanel--label {
@include euiTextTruncate;
padding: 0;
height: $euiButtonHeightSmall;
height: 100%;
}
}

Expand All @@ -38,3 +38,33 @@
.controlFrame__dragHandle {
line-height: 0; // Vertically center the grab handle
}

.controlFrame__formControlLayout:not(.controlFrame__formControlLayout--edit):not(.controlFrame__formControlLayout--twoLine) {
.euiFormControlLayout__prepend {
padding-inline-start: $euiSizeS !important; // to-do remove !important when new controls are merged
}
}

.controlFrame__formControlLayout.controlFrame__formControlLayout--view.timeSlider {
.euiFormControlLayout__prepend {
padding-inline-start: 0 !important; // to-do remove !important when new controls are merged
}
}

.controlFrame__formControlLayout.controlFrame__formControlLayout--twoLine.controlFrame__formControlLayout--edit {
.euiFormControlLayout__prepend {
padding-inline-end: 0 !important; // to-do remove !important when new controls are merged
}
}

.controlFrame__formControlLayout.controlFrame__formControlLayout--twoLine:not(.controlFrame__formControlLayout--edit) {
.euiFormControlLayout__prepend {
padding-inline: 0 !important; // to-do remove !important when new controls are merged
}
}

.controlFrame__formControlLayout:not(.controlFrame__formControlLayout--twoLine).controlFrame__formControlLayout--edit {
.euiFormControlLayout__prepend {
padding-inline-start: $euiSizeXS * 0.5 !important; // skinny icon, to-do remove !important when new controls are merged
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { ControlPanelProps, DefaultControlApi } from '../../controls/types';
import { ControlError } from './control_error';

import './control_panel.scss';
import { A } from '@storybook/components';
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved

const DragHandle = ({
isEditable,
Expand All @@ -56,9 +57,7 @@ const DragHandle = ({
>
<EuiIcon type="grabHorizontal" />
</button>
) : hideEmptyDragHandle ? null : (
<EuiIcon size="s" type="empty" />
);
) :null;

export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlApi>({
Component,
Expand Down Expand Up @@ -113,6 +112,7 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA
viewModeSubject
);
const usingTwoLineLayout = labelPosition === 'twoLine';
const controlType = api ? api.type : null;

const [initialLoadComplete, setInitialLoadComplete] = useState(!dataLoading);
if (!initialLoadComplete && (dataLoading === false || (api && !api.dataLoading))) {
Expand Down Expand Up @@ -162,7 +162,10 @@ export const ControlPanel = <ApiType extends DefaultControlApi = DefaultControlA
fullWidth
isLoading={Boolean(dataLoading)}
compressed
className="controlFrame__formControlLayout"
className={classNames('controlFrame__formControlLayout', {
'controlFrame__formControlLayout--twoLine': usingTwoLineLayout,
'controlFrame__formControlLayout--edit' : isEditable}, `${controlType}`
)}
prepend={
<>
<DragHandle
Expand Down