mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
DRY: light theme sass mixin (#4606)
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
7e498d52d0
commit
b127af7bb6
@ -38,7 +38,7 @@
|
|||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.theme-light) {
|
@include theme-light {
|
||||||
.editor {
|
.editor {
|
||||||
border-color: var(--borderFaintColor);
|
border-color: var(--borderFaintColor);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
|
@include theme-light {
|
||||||
|
.NamespaceSelectFilter {
|
||||||
|
--gradientColor: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.NamespaceSelectFilter {
|
.NamespaceSelectFilter {
|
||||||
--gradientColor: var(--select-menu-bgc);
|
--gradientColor: var(--select-menu-bgc);
|
||||||
|
|
||||||
.Select {
|
.Select {
|
||||||
&.theme-light {
|
|
||||||
--gradientColor: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__placeholder {
|
&__placeholder {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@ -34,12 +36,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
left: 0px;
|
left: 0;
|
||||||
background: linear-gradient(to right, var(--gradientColor) 0px, transparent);
|
background: linear-gradient(to right, var(--gradientColor) 0px, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
right: 0px;
|
right: 0;
|
||||||
background: linear-gradient(to left, var(--gradientColor) 0px, transparent);
|
background: linear-gradient(to left, var(--gradientColor) 0px, transparent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,12 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@include theme-light {
|
||||||
|
.Checkbox {
|
||||||
|
--checkbox-color-active: var(--blue);
|
||||||
|
--checkbox-bgc-active: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.Checkbox {
|
.Checkbox {
|
||||||
--checkbox-color: var(--textColorPrimary); // tick color [√]
|
--checkbox-color: var(--textColorPrimary); // tick color [√]
|
||||||
@ -27,16 +33,6 @@
|
|||||||
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
|
||||||
&.theme {
|
|
||||||
&-dark {
|
|
||||||
// default
|
|
||||||
}
|
|
||||||
&-light {
|
|
||||||
--checkbox-color-active: var(--blue);
|
|
||||||
--checkbox-bgc-active: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
input:not(:checked):not(:disabled) {
|
input:not(:checked):not(:disabled) {
|
||||||
~ .tick:after {
|
~ .tick:after {
|
||||||
@ -47,25 +43,30 @@
|
|||||||
|
|
||||||
input[type="checkbox"] {
|
input[type="checkbox"] {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
&:checked {
|
&:checked {
|
||||||
~ .box {
|
~ .box {
|
||||||
color: var(--checkbox-color-active);
|
color: var(--checkbox-color-active);
|
||||||
background: var(--checkbox-bgc-active);
|
background: var(--checkbox-bgc-active);
|
||||||
border-color: var(--checkbox-bgc-active);
|
border-color: var(--checkbox-bgc-active);
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
~ .box {
|
~ .box {
|
||||||
color: var(--checkbox-color);
|
color: var(--checkbox-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ * {
|
~ * {
|
||||||
opacity: .5;
|
opacity: .5;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:disabled) ~ * {
|
&:not(:disabled) ~ * {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -104,4 +105,4 @@
|
|||||||
margin-left: .5em;
|
margin-left: .5em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,6 @@ import React from "react";
|
|||||||
import { boundMethod, cssNames } from "../../utils";
|
import { boundMethod, cssNames } from "../../utils";
|
||||||
|
|
||||||
export interface CheckboxProps<T = boolean> {
|
export interface CheckboxProps<T = boolean> {
|
||||||
theme?: "dark" | "light";
|
|
||||||
className?: string;
|
className?: string;
|
||||||
label?: React.ReactNode;
|
label?: React.ReactNode;
|
||||||
inline?: boolean;
|
inline?: boolean;
|
||||||
@ -50,12 +49,11 @@ export class Checkbox extends React.PureComponent<CheckboxProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { label, inline, className, value, theme, children, ...inputProps } = this.props;
|
const { label, inline, className, value, children, ...inputProps } = this.props;
|
||||||
const componentClass = cssNames("Checkbox flex align-center", className, {
|
const componentClass = cssNames("Checkbox flex align-center", className, {
|
||||||
inline,
|
inline,
|
||||||
checked: value,
|
checked: value,
|
||||||
disabled: this.props.disabled,
|
disabled: this.props.disabled,
|
||||||
[`theme-${theme}`]: theme,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -244,7 +244,6 @@ export class DeleteClusterDialog extends React.Component {
|
|||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
data-testid="context-switch"
|
data-testid="context-switch"
|
||||||
theme="light"
|
|
||||||
label={(
|
label={(
|
||||||
<>
|
<>
|
||||||
<span className="font-semibold">Select current-context</span>{" "}
|
<span className="font-semibold">Select current-context</span>{" "}
|
||||||
|
|||||||
@ -21,4 +21,10 @@
|
|||||||
|
|
||||||
.KubeObjectDetails {
|
.KubeObjectDetails {
|
||||||
z-index: $zIndex-drawer + 1 !important;
|
z-index: $zIndex-drawer + 1 !important;
|
||||||
|
|
||||||
|
.drawer-title {
|
||||||
|
.Menu {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.theme-light) {
|
@include theme-light {
|
||||||
.editor {
|
.editor {
|
||||||
border: 1px solid gainsboro;
|
border: 1px solid gainsboro;
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
|
|||||||
@ -119,7 +119,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.theme-light {
|
@include theme-light {
|
||||||
.Menu {
|
.Menu {
|
||||||
border: 1px solid var(--borderColor);
|
border: 1px solid var(--borderColor);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,3 +64,14 @@
|
|||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin theme-light() {
|
||||||
|
$selector: "theme-light"; // keep in sync with class in `theme.store.ts`
|
||||||
|
|
||||||
|
body.#{$selector} {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
:global(body.#{$selector}) {
|
||||||
|
@content; // css-modules (*.module.scss)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -145,14 +145,12 @@ export class PortForwardDialog extends Component<Props> {
|
|||||||
</div>
|
</div>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
data-testid="port-forward-https"
|
data-testid="port-forward-https"
|
||||||
theme="light"
|
|
||||||
label="https"
|
label="https"
|
||||||
value={dialogState.useHttps}
|
value={dialogState.useHttps}
|
||||||
onChange={value => dialogState.useHttps = value}
|
onChange={value => dialogState.useHttps = value}
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
data-testid="port-forward-open"
|
data-testid="port-forward-open"
|
||||||
theme="light"
|
|
||||||
label="Open in Browser"
|
label="Open in Browser"
|
||||||
value={dialogState.openInBrowser}
|
value={dialogState.openInBrowser}
|
||||||
onChange={value => dialogState.openInBrowser = value}
|
onChange={value => dialogState.openInBrowser = value}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user