Skip to content

Commit 499f998

Browse files
committed
release(command-palette): v0.3.0
1 parent 620e814 commit 499f998

File tree

3 files changed

+44
-30
lines changed

3 files changed

+44
-30
lines changed

src/command-palette/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "command-palette",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Command palette",
55
"luna": {
66
"react": true

src/command-palette/style.scss

+27-25
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919
max-width: 100%;
2020
box-shadow: theme.$box-shadow;
2121
font-size: 12px;
22-
background: theme.$color-bg-container;
2322
}
2423

2524
.input {
2625
box-sizing: border-box;
2726
outline: none;
2827
width: 100%;
2928
border: none;
30-
border-bottom: 1px solid theme.$color-border;
29+
border-bottom: 1px solid;
3130
padding: 10px 4px;
32-
color: theme.$color-text;
3331
}
3432

3533
.list {
@@ -42,13 +40,6 @@
4240
padding: 5px;
4341
cursor: pointer;
4442
display: flex;
45-
&:hover {
46-
background: theme.$color-fill-secondary;
47-
}
48-
&.active {
49-
color: theme.$color-white;
50-
background: theme.$color-primary;
51-
}
5243
.title {
5344
flex: 1;
5445
overflow: hidden;
@@ -60,22 +51,33 @@
6051
display: none;
6152
}
6253

63-
.theme-dark {
64-
.body {
65-
background: theme.$color-bg-container-dark;
66-
}
67-
.input {
68-
background: theme.$color-bg-container-dark;
69-
border-color: theme.$color-border-dark;
70-
color: theme.$color-text-dark;
71-
}
72-
li {
73-
&:hover {
74-
background: theme.$color-fill-secondary-dark;
54+
$themes: 'light', 'dark';
55+
@each $theme in $themes {
56+
.theme-#{$theme} {
57+
.body {
58+
@include mixin.theme-rule(background-color, color-bg-container, $theme);
59+
}
60+
61+
.input {
62+
@include mixin.theme-rule(background-color, color-bg-container, $theme);
63+
@include mixin.theme-rule(border-color, color-border, $theme);
64+
@include mixin.theme-rule(color, color-text, $theme);
7565
}
76-
&.active {
77-
color: theme.$color-white;
78-
background: theme.$color-primary;
66+
67+
.list {
68+
li {
69+
&:hover {
70+
@include mixin.theme-rule(
71+
background-color,
72+
color-fill-secondary,
73+
$theme
74+
);
75+
}
76+
&.active {
77+
@include mixin.theme-rule(color, color-white, $theme);
78+
@include mixin.theme-rule(background-color, color-primary, $theme);
79+
}
80+
}
7981
}
8082
}
8183
}

src/share/mixin.scss

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
@use './theme' as theme;
2+
@use 'sass:meta';
3+
@use 'sass:map';
24

35
@mixin overflow-auto($direction: 'both') {
46
@if $direction == 'both' {
@@ -9,12 +11,22 @@
911
-webkit-overflow-scrolling: touch;
1012
}
1113

14+
$themeVariables: meta.module-variables(theme);
15+
@mixin theme-rule($name, $value, $theme: 'light') {
16+
$suffix: if($theme == 'dark', '-dark', '');
17+
#{$name}: map.get($themeVariables, #{$value}#{$suffix});
18+
#{$name}: var(
19+
--luna-#{$value},
20+
map.get($themeVariables, #{$value}#{$suffix})
21+
);
22+
}
23+
1224
@mixin component($transparent: false) {
13-
color: theme.$color-text;
25+
@include theme-rule(color, color-text);
1426
@if $transparent {
1527
background-color: transparent;
1628
} @else {
17-
background-color: theme.$color-bg-container;
29+
@include theme-rule(background-color, color-bg-container);
1830
}
1931
font-family: theme.$font-family;
2032
box-sizing: border-box;
@@ -33,11 +45,11 @@
3345
}
3446
&.theme-dark {
3547
color-scheme: dark;
36-
color: theme.$color-text-dark;
48+
@include theme-rule(color, color-text-dark);
3749
@if $transparent {
3850
background-color: transparent;
3951
} @else {
40-
background-color: theme.$color-bg-container-dark;
52+
@include theme-rule(background-color, color-bg-container-dark);
4153
}
4254
}
4355
}

0 commit comments

Comments
 (0)