-
Notifications
You must be signed in to change notification settings - Fork 2
fix: implement feedback #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8d02b55
fix: use span instead of p for proper html
brettkolodny 616cf91
fix: improve indexes and ensure order
brettkolodny 6673829
chore: change div to span to fix invalid html
brettkolodny fa6c04b
chore: move screen reader text
brettkolodny e657681
chore: remove index from key
brettkolodny ed9f884
chore: add sort callback
brettkolodny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,56 +96,59 @@ export const Editor: FC<EditorProps> = ({ | |
<div className="flex items-center gap-2"> | ||
<DropdownMenu> | ||
<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"> | ||
<div className="flex items-center justify-center gap-2"> | ||
<span className="flex items-center justify-center gap-2 text-xs"> | ||
<ZapIcon width={18} height={18} /> | ||
<p className="text-xs">Snippets</p> | ||
</div> | ||
Snippets | ||
</span> | ||
<PlusIcon width={18} height={18} /> | ||
</DropdownMenuTrigger> | ||
|
||
<DropdownMenuPortal> | ||
<DropdownMenuContent align="start"> | ||
{snippets.map( | ||
({ name, label, icon: Icon, snippet }, index) => ( | ||
<DropdownMenuItem | ||
key={index} | ||
onClick={() => onAddSnippet(name, snippet)} | ||
> | ||
<Icon size={24} /> | ||
{label} | ||
</DropdownMenuItem> | ||
), | ||
)} | ||
{snippets.map(({ name, label, icon: Icon, snippet }) => ( | ||
<DropdownMenuItem | ||
key={label} | ||
onClick={() => onAddSnippet(name, snippet)} | ||
> | ||
<Icon size={24} /> | ||
{label} | ||
</DropdownMenuItem> | ||
))} | ||
</DropdownMenuContent> | ||
</DropdownMenuPortal> | ||
</DropdownMenu> | ||
|
||
<DropdownMenu> | ||
<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"> | ||
<div className="flex items-center justify-center gap-2"> | ||
<span className="flex items-center justify-center gap-2 text-xs"> | ||
<NotebookPenIcon width={18} height={18} /> | ||
<p className="text-xs">Examples</p> | ||
</div> | ||
Example | ||
</span> | ||
<ChevronDownIcon width={18} height={18} /> | ||
</DropdownMenuTrigger> | ||
|
||
<DropdownMenuPortal> | ||
<DropdownMenuContent> | ||
{Object.entries(examples).map(([slug, title]) => { | ||
const href = `${window.location.origin}/parameters/example/${slug}`; | ||
return ( | ||
<DropdownMenuItem key={slug} asChild={true}> | ||
<a href={href} target="_blank" rel="noreferrer"> | ||
<span className="sr-only"> | ||
{" "} | ||
(link opens in new tab) | ||
</span> | ||
<ExternalLinkIcon /> | ||
{title} | ||
</a> | ||
</DropdownMenuItem> | ||
); | ||
})} | ||
{Object.entries(examples) | ||
.sort() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One last change: because we didn't give a callback, |
||
.map(([slug, title]) => { | ||
const href = `${window.location.origin}/parameters/example/${slug}`; | ||
return ( | ||
<DropdownMenuItem | ||
key={slug} | ||
asChild={true} | ||
> | ||
<a href={href} target="_blank" rel="noreferrer"> | ||
<ExternalLinkIcon /> | ||
{title} | ||
<span className="sr-only"> | ||
brettkolodny marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{" "} | ||
(link opens in new tab) | ||
</span> | ||
</a> | ||
</DropdownMenuItem> | ||
); | ||
})} | ||
</DropdownMenuContent> | ||
</DropdownMenuPortal> | ||
</DropdownMenu> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.