mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix gradients in namespace selector
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
b989cc41c8
commit
4378a58b81
@ -0,0 +1,41 @@
|
|||||||
|
.NamespaceSelectFilter {
|
||||||
|
.Select {
|
||||||
|
&__placeholder {
|
||||||
|
width: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: scroll!important;
|
||||||
|
text-overflow: unset!important;
|
||||||
|
margin-left: -8px;
|
||||||
|
padding-left: 8px;
|
||||||
|
margin-right: -8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__value-container {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::before, &::after {
|
||||||
|
content: ' ';
|
||||||
|
position: absolute;
|
||||||
|
z-index: 20;
|
||||||
|
display: block;
|
||||||
|
width: 8px;
|
||||||
|
height: var(--font-size);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
left: 0px;
|
||||||
|
background: linear-gradient(to right, var(--contentColor) 0px, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
right: 0px;
|
||||||
|
background: linear-gradient(to left, var(--contentColor) 0px, transparent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -71,6 +71,7 @@ export class NamespaceSelectFilter extends React.Component {
|
|||||||
placeholder={""}
|
placeholder={""}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
formatOptionLabel={this.formatOptionLabel}
|
formatOptionLabel={this.formatOptionLabel}
|
||||||
|
className="NamespaceSelectFilter"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,23 +23,6 @@
|
|||||||
|
|
||||||
.NamespaceSelect {
|
.NamespaceSelect {
|
||||||
@include namespaceSelectCommon;
|
@include namespaceSelectCommon;
|
||||||
|
|
||||||
.Select {
|
|
||||||
&__placeholder {
|
|
||||||
width: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: scroll!important;
|
|
||||||
text-overflow: unset!important;
|
|
||||||
margin-left: -8px;
|
|
||||||
padding-left: 8px;
|
|
||||||
margin-right: -8px;
|
|
||||||
padding-right: 8px;
|
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.NamespaceSelectMenu {
|
.NamespaceSelectMenu {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import "./namespace-select.scss";
|
import "./namespace-select-filter.scss";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
@ -8,7 +8,6 @@ import { cssNames } from "../../utils";
|
|||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { namespaceStore } from "./namespace.store";
|
import { namespaceStore } from "./namespace.store";
|
||||||
import { kubeWatchApi } from "../../api/kube-watch-api";
|
import { kubeWatchApi } from "../../api/kube-watch-api";
|
||||||
import { components, OptionTypeBase, ValueContainerProps } from "react-select";
|
|
||||||
|
|
||||||
interface Props extends SelectProps {
|
interface Props extends SelectProps {
|
||||||
showIcons?: boolean;
|
showIcons?: boolean;
|
||||||
@ -22,16 +21,6 @@ const defaultProps: Partial<Props> = {
|
|||||||
showClusterOption: false,
|
showClusterOption: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
function GradientValueContainer({children, ...rest}: ValueContainerProps<OptionTypeBase, boolean>) {
|
|
||||||
return (
|
|
||||||
<components.ValueContainer {...rest}>
|
|
||||||
<div className="GradientValueContainer front" />
|
|
||||||
{children}
|
|
||||||
<div className="GradientValueContainer back" />
|
|
||||||
</components.ValueContainer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class NamespaceSelect extends React.Component<Props> {
|
export class NamespaceSelect extends React.Component<Props> {
|
||||||
static defaultProps = defaultProps as object;
|
static defaultProps = defaultProps as object;
|
||||||
@ -77,8 +66,6 @@ export class NamespaceSelect extends React.Component<Props> {
|
|||||||
render() {
|
render() {
|
||||||
const { className, showIcons, customizeOptions, components = {}, ...selectProps } = this.props;
|
const { className, showIcons, customizeOptions, components = {}, ...selectProps } = this.props;
|
||||||
|
|
||||||
components.ValueContainer ??= GradientValueContainer;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
className={cssNames("NamespaceSelect", className)}
|
className={cssNames("NamespaceSelect", className)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user