1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Adding lens Select theme

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-04-05 11:20:34 +03:00
parent 2d4decd0fb
commit 9de5f731d8
4 changed files with 87 additions and 20 deletions

View File

@ -104,6 +104,7 @@ export class HelmCharts extends React.Component {
formatOptionLabel={this.formatOptionLabel} formatOptionLabel={this.formatOptionLabel}
controlShouldRenderValue={false} controlShouldRenderValue={false}
className="box grow" className="box grow"
themeName="lens"
/> />
<Button <Button
primary primary

View File

@ -48,6 +48,7 @@ export const KubectlBinaries = observer(({ preferences }: { preferences: UserPre
value={preferences.downloadMirror} value={preferences.downloadMirror}
onChange={({ value }: SelectOption) => preferences.downloadMirror = value} onChange={({ value }: SelectOption) => preferences.downloadMirror = value}
disabled={!preferences.downloadKubectlBinaries} disabled={!preferences.downloadKubectlBinaries}
themeName="lens"
/> />
</section> </section>

View File

@ -5,6 +5,7 @@ html {
$menuBackgroundColor: $contentColor; $menuBackgroundColor: $contentColor;
--select-menu-bgc: #{$menuBackgroundColor}; --select-menu-bgc: #{$menuBackgroundColor};
--select-menu-border-color: #{$halfGray};
--select-option-selected-color: #{$inputOptionHoverColor}; --select-option-selected-color: #{$inputOptionHoverColor};
--select-option-focused-bgc: #{$colorInfo}; --select-option-focused-bgc: #{$colorInfo};
--select-option-focused-color: #{$textColorAccent}; --select-option-focused-color: #{$textColorAccent};
@ -13,17 +14,7 @@ html {
position: relative; position: relative;
min-width: 220px; min-width: 220px;
:hover {
&.Select__control {
box-shadow: 0 0 0 1px var(--inputControlHoverBorder);
}
}
:focus-within {
&.Select__control {
box-shadow: 0 0 0 1px $colorInfo;
}
}
* { * {
color: inherit; color: inherit;
@ -40,8 +31,7 @@ html {
border-radius: $radius; border-radius: $radius;
background: transparent; background: transparent;
min-height: 0; min-height: 0;
box-shadow: 0 0 0 1px var(--inputControlBorder); // TODO: make theme-aware colors box-shadow: 0 0 0 1px $halfGray;
background: var(--inputControlBackground);
cursor: pointer; cursor: pointer;
&--is-focused { &--is-focused {
@ -80,7 +70,7 @@ html {
&__menu { &__menu {
background: var(--select-menu-bgc); background: var(--select-menu-bgc);
box-shadow: inset 0 0 0 1px var(--inputControlHoverBorder); box-shadow: inset 0 0 0 1px var(--select-menu-border-color);
width: max-content; width: max-content;
min-width: 100%; min-width: 100%;
@ -98,19 +88,19 @@ html {
&__option { &__option {
white-space: nowrap; white-space: nowrap;
cursor: pointer; cursor: pointer;
border-radius: 4px;
&:active { &:active {
background: var(--inputControlBackground); background: $primary;
} }
&--is-selected { &--is-selected {
background: var(--inputControlBackground); background: var(--menuSelectedOptionBgc);
color: var(--textColorAccent); color: var(--select-option-selected-color);
} }
&--is-focused { &--is-focused {
background: var(--inputControlBackground); color: var(--select-option-focused-color);
background: var(--select-option-focused-bgc);
} }
&--is-disabled { &--is-disabled {
@ -154,6 +144,32 @@ html {
} }
.Select, .Select__menu { .Select, .Select__menu {
&.theme-light {
--select-menu-bgc: white;
--select-option-selected-color: $textColorSecondary;
.Select {
&__multi-value {
background: none;
box-shadow: 0 0 0 1px $textColorSecondary;
}
&__option {
&:active {
color: white;
}
&:hover {
color: white;
}
&--is-focused {
color: white;
}
}
}
}
&.theme-outlined { &.theme-outlined {
.Select__control { .Select__control {
box-shadow: 0 0 0 1px $colorVague; box-shadow: 0 0 0 1px $colorVague;
@ -168,5 +184,54 @@ html {
} }
} }
} }
&.theme-lens {
:hover {
&.Select__control {
box-shadow: 0 0 0 1px var(--inputControlHoverBorder);
}
}
:focus-within {
&.Select__control {
box-shadow: 0 0 0 1px $colorInfo;
}
}
&.Select__menu {
box-shadow: inset 0 0 0 1px var(--inputControlBorder);
}
.Select {
&__control {
box-shadow: 0 0 0 1px var(--inputControlBorder);
background: var(--inputControlBackground);
}
&__menu {
&-list {
padding: 6px;
}
}
&__option {
border-radius: 4px;
&:active {
background: var(--inputControlBackground);
}
&--is-selected {
background: var(--inputControlBackground);
color: var(--textColorAccent);
}
&--is-focused {
color: var(--textColorPrimary);
background: var(--inputControlBackground);
}
}
}
}
} }
} }

View File

@ -24,7 +24,7 @@ export interface SelectOption<T = any> {
export interface SelectProps<T = any> extends ReactSelectProps<T>, CreatableProps<T> { export interface SelectProps<T = any> extends ReactSelectProps<T>, CreatableProps<T> {
value?: T; value?: T;
themeName?: "dark" | "light" | "outlined"; themeName?: "dark" | "light" | "outlined" | "lens";
menuClass?: string; menuClass?: string;
isCreatable?: boolean; isCreatable?: boolean;
autoConvertOptions?: boolean; // to internal format (i.e. {value: T, label: string}[]), not working with groups autoConvertOptions?: boolean; // to internal format (i.e. {value: T, label: string}[]), not working with groups