@@ -96,56 +96,61 @@ export const Editor: FC<EditorProps> = ({
96
96
< div className = "flex items-center gap-2" >
97
97
< DropdownMenu >
98
98
< 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 " >
100
100
< ZapIcon width = { 18 } height = { 18 } />
101
- < p className = "text-xs" > Snippets</ p >
102
- </ div >
101
+ Snippets
102
+ </ span >
103
103
< PlusIcon width = { 18 } height = { 18 } />
104
104
</ DropdownMenuTrigger >
105
105
106
106
< DropdownMenuPortal >
107
107
< 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
+ ) ) }
119
117
</ DropdownMenuContent >
120
118
</ DropdownMenuPortal >
121
119
</ DropdownMenu >
122
120
123
121
< DropdownMenu >
124
122
< 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 " >
126
124
< NotebookPenIcon width = { 18 } height = { 18 } />
127
- < p className = "text-xs" > Examples </ p >
128
- </ div >
125
+ Example
126
+ </ span >
129
127
< ChevronDownIcon width = { 18 } height = { 18 } />
130
128
</ DropdownMenuTrigger >
131
129
132
130
< DropdownMenuPortal >
133
131
< 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
+ } ) }
149
154
</ DropdownMenuContent >
150
155
</ DropdownMenuPortal >
151
156
</ DropdownMenu >
0 commit comments