Skip to content

Commit 1557945

Browse files
authored
Merge pull request #51 from coder/brett/fix-semantic-html
fix: implement feedback
2 parents e50bcc9 + ed9f884 commit 1557945

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

src/client/editor/Editor.tsx

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -96,56 +96,61 @@ export const Editor: FC<EditorProps> = ({
9696
<div className="flex items-center gap-2">
9797
<DropdownMenu>
9898
<DropdownMenuTrigger className="flex w-fit min-w-[140px] cursor-pointer items-center justify-between rounded-md border bg-surface-primary px-2 py-1.5 text-content-secondary transition-colors hover:text-content-primary data-[state=open]:text-content-primary">
99-
<div className="flex items-center justify-center gap-2">
99+
<span className="flex items-center justify-center gap-2 text-xs">
100100
<ZapIcon width={18} height={18} />
101-
<p className="text-xs">Snippets</p>
102-
</div>
101+
Snippets
102+
</span>
103103
<PlusIcon width={18} height={18} />
104104
</DropdownMenuTrigger>
105105

106106
<DropdownMenuPortal>
107107
<DropdownMenuContent align="start">
108-
{snippets.map(
109-
({ name, label, icon: Icon, snippet }, index) => (
110-
<DropdownMenuItem
111-
key={index}
112-
onClick={() => onAddSnippet(name, snippet)}
113-
>
114-
<Icon size={24} />
115-
{label}
116-
</DropdownMenuItem>
117-
),
118-
)}
108+
{snippets.map(({ name, label, icon: Icon, snippet }) => (
109+
<DropdownMenuItem
110+
key={label}
111+
onClick={() => onAddSnippet(name, snippet)}
112+
>
113+
<Icon size={24} />
114+
{label}
115+
</DropdownMenuItem>
116+
))}
119117
</DropdownMenuContent>
120118
</DropdownMenuPortal>
121119
</DropdownMenu>
122120

123121
<DropdownMenu>
124122
<DropdownMenuTrigger className="flex w-fit min-w-[140px] cursor-pointer items-center justify-between rounded-md border bg-surface-primary px-2 py-1.5 text-content-secondary transition-colors hover:text-content-primary data-[state=open]:text-content-primary">
125-
<div className="flex items-center justify-center gap-2">
123+
<span className="flex items-center justify-center gap-2 text-xs">
126124
<NotebookPenIcon width={18} height={18} />
127-
<p className="text-xs">Examples</p>
128-
</div>
125+
Example
126+
</span>
129127
<ChevronDownIcon width={18} height={18} />
130128
</DropdownMenuTrigger>
131129

132130
<DropdownMenuPortal>
133131
<DropdownMenuContent>
134-
{Object.entries(examples).map(([slug, title]) => {
135-
const href = `${window.location.origin}/parameters/example/${slug}`;
136-
return (
137-
<DropdownMenuItem key={slug} asChild={true}>
138-
<a href={href} target="_blank" rel="noreferrer">
139-
<span className="sr-only">
140-
{" "}
141-
(link opens in new tab)
142-
</span>
143-
<ExternalLinkIcon />
144-
{title}
145-
</a>
146-
</DropdownMenuItem>
147-
);
148-
})}
132+
{Object.entries(examples)
133+
.sort(([_slugA, titleA], [_slugB, titleB]) => {
134+
return titleA.localeCompare(titleB)
135+
})
136+
.map(([slug, title]) => {
137+
const href = `${window.location.origin}/parameters/example/${slug}`;
138+
return (
139+
<DropdownMenuItem
140+
key={slug}
141+
asChild={true}
142+
>
143+
<a href={href} target="_blank" rel="noreferrer">
144+
<ExternalLinkIcon />
145+
{title}
146+
<span className="sr-only">
147+
{" "}
148+
(link opens in new tab)
149+
</span>
150+
</a>
151+
</DropdownMenuItem>
152+
);
153+
})}
149154
</DropdownMenuContent>
150155
</DropdownMenuPortal>
151156
</DropdownMenu>

0 commit comments

Comments
 (0)