Skip to content

Commit 717a805

Browse files
committed
style(demo): make editor preset tabs look like links
1 parent 9d4bac9 commit 717a805

2 files changed

Lines changed: 45 additions & 7 deletions

File tree

demo/src/components/Editor.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ export default function AppEditor({
9999
<ul>
100100
{views.map((v) => (
101101
<li key={v.id}>
102-
{v.id === view ? (
103-
v.label
104-
) : (
105-
<button type="button" onClick={() => handleViewChange(v.id)}>
106-
{v.label}
107-
</button>
108-
)}
102+
<button
103+
type="button"
104+
className={`view-tab ${v.id === view ? 'active' : ''}`}
105+
onClick={() => handleViewChange(v.id)}
106+
>
107+
{v.label}
108+
</button>
109109
</li>
110110
))}
111111
</ul>

demo/src/styles/editor.scss

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,44 @@ $button-background: #3498db;
3030
padding-right: 0;
3131
}
3232
}
33+
34+
.view-tab {
35+
background: none;
36+
border: none;
37+
padding: 0;
38+
font: inherit;
39+
cursor: pointer;
40+
color: #555;
41+
text-decoration: none;
42+
outline: none;
43+
44+
&:hover {
45+
color: #3498db;
46+
text-decoration: underline;
47+
}
48+
49+
&:focus-visible {
50+
outline: 2px solid #3498db;
51+
outline-offset: 2px;
52+
border-radius: 2px;
53+
}
54+
55+
&.active {
56+
color: #333;
57+
font-weight: bold;
58+
position: relative;
59+
60+
&::after {
61+
content: '';
62+
position: absolute;
63+
left: 0;
64+
right: 0;
65+
bottom: 0;
66+
height: 2px;
67+
background: #3498db;
68+
}
69+
}
70+
}
3371
}
3472
.editor-wrapper {
3573
flex: 1;

0 commit comments

Comments
 (0)