-
Notifications
You must be signed in to change notification settings - Fork 101
Turn "Copy as markdown" into a split button and delete "Use Octopus docs with AI" #3384
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
Open
enf0rc3
wants to merge
7
commits into
main
Choose a base branch
from
willlaugesen/nes-294-copy-as-markdown-split-button
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ffa5bee
Turn "Copy as markdown" into a split button and delete "Use Octopus d…
enf0rc3 a068606
Drop the SplitButton label guard
enf0rc3 f8a5d30
Keep SplitButton's props as they were
enf0rc3 47d9c58
Drop the failed-copy state from the markdown copy action
enf0rc3 c78ed94
Move the copy control's tests to the copy button spec
enf0rc3 f53e46a
Move the copy action's styles into its component
enf0rc3 3079b9e
Use the markdown icon design supplied
enf0rc3 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
|
|
@@ -12,7 +12,8 @@ export type SplitButtonItem = { | |
|
|
||
| type Props = HTMLAttributes<'div'> & { | ||
| label: string; | ||
| href: string | URL; | ||
| // Omitted when the primary acts on the page rather than navigating away | ||
| href?: string | URL; | ||
| icon?: string; | ||
| size?: 'xSmall' | 'small' | 'medium'; | ||
| importance?: 'default' | 'loud'; | ||
|
|
@@ -40,6 +41,12 @@ if (items.length === 0) { | |
| throw new Error('A SplitButton with no menu items should just be a Button'); | ||
| } | ||
|
|
||
| // Button types the two halves of its own union separately - an anchor needs an | ||
| // `href`, a plain button forbids one - so the link attributes are handed over as | ||
| // a set rather than as three possibly-undefined props. `target` and `rel` say | ||
| // where a link opens, and mean nothing on a button. | ||
| const primaryLink = href ? { href, target, rel } : {}; | ||
|
Contributor
Author
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. allows "non href" button that doesn't link anywhere. (client side only) |
||
|
|
||
| const menuItems = items.map((item) => ({ | ||
| ...item, | ||
| kind: 'link' as const, | ||
|
|
@@ -51,14 +58,14 @@ const menuItems = items.map((item) => ({ | |
| <div class:list={['split-btn', className]} {...rest}> | ||
| <Button | ||
| class="split-btn__primary" | ||
| href={href} | ||
| {...primaryLink} | ||
| icon={icon} | ||
| label={label} | ||
| size={size} | ||
| importance={importance} | ||
| target={target} | ||
| rel={rel} | ||
| /> | ||
| > | ||
| <slot /> | ||
| </Button> | ||
| <Menu | ||
| class="split-btn__menu" | ||
| label={menuLabel} | ||
|
|
||
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
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ellen provided an icon in Slack that looked quite different to this one. I see in the PR description it's mentioned that it should be switched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh didn't notice that, ill update it to use the one she provided, thanks for spotting that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rosslovas Done thanks!