1
0
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:
Roman 2021-12-27 13:21:14 +02:00 committed by GitHub
parent 7e498d52d0
commit b127af7bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 41 additions and 26 deletions

View File

@ -38,7 +38,7 @@
border-radius: var(--border-radius);
}
:global(.theme-light) {
@include theme-light {
.editor {
border-color: var(--borderFaintColor);
}

View File

@ -1,11 +1,13 @@
@include theme-light {
.NamespaceSelectFilter {
--gradientColor: white;
}
}
.NamespaceSelectFilter {
--gradientColor: var(--select-menu-bgc);
.Select {
&.theme-light {
--gradientColor: white;
}
&__placeholder {
width: 100%;
white-space: nowrap;
@ -34,12 +36,12 @@
}
&::before {
left: 0px;
left: 0;
background: linear-gradient(to right, var(--gradientColor) 0px, transparent);
}
&::after {
right: 0px;
right: 0;
background: linear-gradient(to left, var(--gradientColor) 0px, transparent);
}
}

View File

@ -19,6 +19,12 @@
* 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-color: var(--textColorPrimary); // tick color []
@ -27,16 +33,6 @@
flex-shrink: 0;
&.theme {
&-dark {
// default
}
&-light {
--checkbox-color-active: var(--blue);
--checkbox-bgc-active: none;
}
}
&:hover {
input:not(:checked):not(:disabled) {
~ .tick:after {
@ -47,25 +43,30 @@
input[type="checkbox"] {
display: none;
&:checked {
~ .box {
color: var(--checkbox-color-active);
background: var(--checkbox-bgc-active);
border-color: var(--checkbox-bgc-active);
&:after {
opacity: 1;
}
}
}
&:disabled {
~ .box {
color: var(--checkbox-color);
}
~ * {
opacity: .5;
pointer-events: none;
}
}
&:not(:disabled) ~ * {
cursor: pointer;
}
@ -104,4 +105,4 @@
margin-left: .5em;
}
}
}
}

View File

@ -24,7 +24,6 @@ import React from "react";
import { boundMethod, cssNames } from "../../utils";
export interface CheckboxProps<T = boolean> {
theme?: "dark" | "light";
className?: string;
label?: React.ReactNode;
inline?: boolean;
@ -50,12 +49,11 @@ export class Checkbox extends React.PureComponent<CheckboxProps> {
}
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, {
inline,
checked: value,
disabled: this.props.disabled,
[`theme-${theme}`]: theme,
});
return (

View File

@ -244,7 +244,6 @@ export class DeleteClusterDialog extends React.Component {
<div className="mt-4">
<Checkbox
data-testid="context-switch"
theme="light"
label={(
<>
<span className="font-semibold">Select current-context</span>{" "}

View File

@ -21,4 +21,10 @@
.KubeObjectDetails {
z-index: $zIndex-drawer + 1 !important;
.drawer-title {
.Menu {
border: none;
}
}
}

View File

@ -33,7 +33,7 @@
}
}
:global(.theme-light) {
@include theme-light {
.editor {
border: 1px solid gainsboro;
border-radius: var(--border-radius);

View File

@ -119,7 +119,7 @@
}
}
.theme-light {
@include theme-light {
.Menu {
border: 1px solid var(--borderColor);
}

View File

@ -64,3 +64,14 @@
-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)
}
}

View File

@ -145,14 +145,12 @@ export class PortForwardDialog extends Component<Props> {
</div>
<Checkbox
data-testid="port-forward-https"
theme="light"
label="https"
value={dialogState.useHttps}
onChange={value => dialogState.useHttps = value}
/>
<Checkbox
data-testid="port-forward-open"
theme="light"
label="Open in Browser"
value={dialogState.openInBrowser}
onChange={value => dialogState.openInBrowser = value}