diff --git a/src/renderer/components/+namespaces/namespace-select.scss b/src/renderer/components/+namespaces/namespace-select.scss index f56b8005cc..33293a6d7a 100644 --- a/src/renderer/components/+namespaces/namespace-select.scss +++ b/src/renderer/components/+namespaces/namespace-select.scss @@ -4,6 +4,23 @@ } } +.GradientValueContainer { + width: 8px; + height: var(--font-size); + position: absolute; + z-index: 20; + + &.front { + left: 0px; + background: linear-gradient(to right, var(--contentColor) 0px, transparent); + } + + &.back { + right: 0px; + background: linear-gradient(to left, var(--contentColor) 0px, transparent); + } +} + .NamespaceSelect { @include namespaceSelectCommon; @@ -11,12 +28,19 @@ &__placeholder { width: 100%; white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; + overflow: scroll; + margin-left: -8px; + padding-left: 8px; + margin-right: -8px; + padding-right: 8px; + + &::-webkit-scrollbar { + display: none; + } } } } .NamespaceSelectMenu { @include namespaceSelectCommon; -} \ No newline at end of file +} diff --git a/src/renderer/components/+namespaces/namespace-select.tsx b/src/renderer/components/+namespaces/namespace-select.tsx index 775cace4d3..d398f91f0a 100644 --- a/src/renderer/components/+namespaces/namespace-select.tsx +++ b/src/renderer/components/+namespaces/namespace-select.tsx @@ -8,6 +8,7 @@ import { cssNames } from "../../utils"; import { Icon } from "../icon"; import { namespaceStore } from "./namespace.store"; import { kubeWatchApi } from "../../api/kube-watch-api"; +import { components, ValueContainerProps } from "react-select"; interface Props extends SelectProps { showIcons?: boolean; @@ -21,6 +22,16 @@ const defaultProps: Partial = { showClusterOption: false, }; +function GradientValueContainer({children, ...rest}: ValueContainerProps) { + return ( + +
+ {children} +
+ + ); +} + @observer export class NamespaceSelect extends React.Component { static defaultProps = defaultProps as object; @@ -64,7 +75,9 @@ export class NamespaceSelect extends React.Component { }; render() { - const { className, showIcons, customizeOptions, ...selectProps } = this.props; + const { className, showIcons, customizeOptions, components = {}, ...selectProps } = this.props; + + components.ValueContainer ??= GradientValueContainer; return (