Skip to content

Commit d039c5d

Browse files
committed
样式
1 parent eeec1c8 commit d039c5d

File tree

4 files changed

+20
-35
lines changed

4 files changed

+20
-35
lines changed

src/editor/inputs/implicit.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<template>
22
<div class="input-inner">
33
<div class="field main-fn">
4-
<s-text-field
4+
<FilledTextfield
55
class="styled fn"
6-
ref="inputBox"
76
label="F(x, y)"
87
v-model="self.fn"
9-
>
10-
</s-text-field>
8+
/>
119
<span class="label styled"> =0 </span>
1210
</div>
1311
<s-fold :folded="props.folded">
@@ -27,6 +25,8 @@ import { toRef } from "vue";
2725
import { useI18n } from "vue-i18n";
2826
const { t } = useI18n();
2927
28+
import FilledTextfield from "@/ui/components/filled-textfield.vue";
29+
3030
const props = defineProps<{
3131
folded: boolean;
3232
self: PrivateDataTypes.Implicit;

src/editor/inputs/linear.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<div class="input-inner">
33
<div class="field main-fn">
44
<span class="label styled">y=</span>
5-
<filledTextfield class="styled fn" label="f(x)" v-model="self.fn">
6-
</filledTextfield>
5+
<filledTextfield class="styled fn" label="f(x)" v-model="self.fn" />
76
</div>
87
<s-fold :folded="props.folded">
98
<s-divider>{{ t("title.moreOptions") }}</s-divider>
@@ -36,19 +35,20 @@ import FilledTextfield from "@/ui/components/filled-textfield.vue";
3635
.input-inner {
3736
display: flex;
3837
flex-direction: column;
38+
gap: 6px;
3939
4040
.field.main-fn {
4141
display: flex;
4242
align-items: center;
4343
font-size: 25px;
4444
.label {
45-
margin: 0 0.1em -0.1em 0;
45+
margin: 0 0.1em 0 0;
4646
width: 1.8em;
4747
margin-left: 0;
4848
text-align: right;
4949
}
5050
.fn {
51-
font-size: 22px;
51+
font-size: 24px;
5252
width: 0;
5353
flex-grow: 1;
5454
}

src/editor/inputs/parametric.vue

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@
22
<div class="input-inner">
33
<div class="field main-fn">
44
<span class="label styled">x=</span>
5-
<s-text-field
6-
class="styled fn"
7-
ref="inputBox"
8-
label="f(t)"
9-
v-model="self.x"
10-
>
11-
</s-text-field>
5+
<FilledTextfield class="styled fn" label="f(t)" v-model="self.x" />
126
</div>
137
<div class="field main-fn">
148
<span class="label styled">y=</span>
15-
<s-text-field
16-
class="styled fn"
17-
ref="inputBox"
18-
label="g(t)"
19-
v-model="self.y"
20-
>
21-
</s-text-field>
9+
<FilledTextfield class="styled fn" label="g(t)" v-model="self.y" />
2210
</div>
2311
<s-fold :folded="props.folded">
2412
<s-divider>{{ t("title.moreOptions") }}</s-divider>
@@ -37,6 +25,8 @@ import { toRef } from "vue";
3725
import { useI18n } from "vue-i18n";
3826
const { t } = useI18n();
3927
28+
import FilledTextfield from "@/ui/components/filled-textfield.vue";
29+
4030
const props = defineProps<{
4131
folded: boolean;
4232
self: PrivateDataTypes.Parametric;

src/ui/components/filled-textfield.vue

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="filled-textfield" :class="{ focus: isFocus }">
3-
<label :class="{ lifted: isFocus || !isEmpty }">{{ props.label }}</label>
3+
<label :class="{ lifted: !isEmpty }">{{ props.label }}</label>
44
<input
55
@focus="isFocus = true"
66
@blur="isFocus = false"
@@ -26,18 +26,15 @@ const isEmpty = computed(() => value.value === "");
2626
background-color: var(--s-color-surface-container-high);
2727
border-top-left-radius: 5px;
2828
border-top-right-radius: 5px;
29-
border-bottom: var(--s-color-outline) solid 0.15em;
29+
border-bottom: var(--s-color-outline) solid 0.1em;
3030
transition:
3131
background-color 0.2s,
3232
border-bottom-color 0.2s;
33-
padding: 1em 0.6em 0.3em 0.6em;
33+
padding: 0;
3434
display: flex;
3535
&.focus {
3636
background-color: var(--s-color-surface-container-highest);
3737
border-bottom-color: var(--s-color-primary);
38-
label {
39-
color: var(--s-color-primary);
40-
}
4138
}
4239
input {
4340
background-color: transparent;
@@ -48,22 +45,20 @@ const isEmpty = computed(() => value.value === "");
4845
display: block;
4946
width: 0;
5047
flex-grow: 1;
51-
padding: 0;
48+
padding: 0.4em 0.45em 0.3em 0.45em;
49+
caret-color: var(--s-color-primary);
5250
line-height: 1.2;
5351
z-index: 1;
5452
}
5553
label {
5654
color: var(--s-color-outline);
5755
position: absolute;
5856
line-height: 1.2;
59-
transition:
60-
transform 0.2s,
61-
font-size 0.2s;
62-
transform: translateY(-0.3em);
57+
transition: opacity 0.1s;
58+
padding: 0.35em 0.45em 0.3em 0.45em;
6359
}
6460
label.lifted {
65-
transform: translateY(-120%);
66-
font-size: 0.6em;
61+
opacity: 0;
6762
}
6863
}
6964
</style>

0 commit comments

Comments
 (0)