Skip to content

Commit e586948

Browse files
Merge pull request #50 from preactjs/visual-fixes
Minor UI polishing
2 parents 8a21399 + de2eb4f commit e586948

File tree

6 files changed

+34
-5
lines changed

6 files changed

+34
-5
lines changed

src/view/components/DataInput/DataInput.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
padding-right: 0.2em;
2929
min-width: 0;
3030
box-shadow: none;
31+
white-space: nowrap;
32+
text-overflow: ellipsis;
3133
}
3234

3335
.innerWrapper {

src/view/components/DataInput/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface InputProps {
1111
name: string;
1212
value: any;
1313
class?: string;
14+
placeholder?: string;
1415
onChange: (value: any) => void;
1516
}
1617

@@ -84,6 +85,7 @@ export function DataInput({ value, onChange, name, ...props }: InputProps) {
8485
onBlur={store.onBlur}
8586
onKeyUp={onKeyUp}
8687
onInput={onInput}
88+
placeholder={props.placeholder}
8789
data-type={type}
8890
/>
8991
<button

src/view/components/IconBtn.css

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,33 @@
2727
display: flex;
2828
justify-content: center;
2929
align-items: center;
30+
outline: none;
31+
}
32+
33+
.root:active .inner,
34+
.root:focus .inner {
35+
position: relative;
36+
z-index: 2;
3037
}
3138

3239
.root:not([disabled])[data-active] .inner,
3340
.root:focus .inner,
34-
.root:not([disabled]) .inner:active {
41+
.root:not([disabled]):active .inner {
3542
color: var(--color-selected-text);
3643
}
3744

38-
.root:focus-within .inner::after,
39-
.root:not([disabled]):active .inner::after,
40-
.root:not([disabled])[data-active] .inner::after {
45+
.bg {
46+
display: none;
47+
}
48+
49+
.root:focus .bg {
50+
z-index: -1;
51+
}
52+
53+
.root:focus-within .bg,
54+
.root:not([disabled]):active .bg,
55+
.root:not([disabled])[data-active] .bg {
56+
display: block;
4157
content: "";
4258
position: absolute;
4359
left: -0.25rem;

src/view/components/IconBtn.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function IconBtn(props: Props) {
2525
>
2626
<span class={s.inner} tabIndex={-1}>
2727
{props.children}
28+
<span class={s.bg} />
2829
</span>
2930
</button>
3031
);

src/view/components/sidebar/NewProp.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
background: var(--color-props-input-bg);
1111
}
1212

13+
.nameWrapper::after {
14+
margin: 0 0.2rem;
15+
display: inline-block;
16+
}
17+
1318
.value {
1419
background: var(--color-props-input-bg);
1520
max-width: 5rem;
21+
padding-left: 0.2rem;
22+
border: 1px solid #aaa;
1623
}

src/view/components/sidebar/NewProp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function NewProp(props: NewPropProps) {
2929

3030
return (
3131
<div class={s.root}>
32-
<div class={s2.name}>
32+
<div class={`${s2.name} ${s.nameWrapper}`}>
3333
<input
3434
type="text"
3535
placeholder="new prop"
@@ -42,6 +42,7 @@ export function NewProp(props: NewPropProps) {
4242
class={s.value}
4343
value={undefined}
4444
onChange={onCommit}
45+
placeholder="new value"
4546
name="foobar"
4647
/>
4748
</div>

0 commit comments

Comments
 (0)