-
-
Notifications
You must be signed in to change notification settings - Fork 218
feat: extract button and link component, unify and improve design #1071
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
essenmitsosse
wants to merge
96
commits into
npmx-dev:main
Choose a base branch
from
essenmitsosse:fix-a11y-extract-btn-component
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.
+666
−800
Open
Changes from all commits
Commits
Show all changes
96 commits
Select commit
Hold shift + click to select a range
c3aaa42
fix: invalid link attribute
essenmitsosse 6c271b3
fix: cleanup component
essenmitsosse 59b5c3c
refactor: extract reusable button component
essenmitsosse a2872d6
refactor: remove uno btn shortcut
essenmitsosse 77c6267
test: add button tests
essenmitsosse 45b86a7
refactor: change search button to new component
essenmitsosse dfba6b6
fix(style): disabled button
essenmitsosse 05a4cfa
refactor: use button component for connector and social buttons
essenmitsosse 949c0b9
refactor: use button component for modal close button
essenmitsosse c926dce
style: remove default button and link style
essenmitsosse 2e093db
refactor: move pressed style to css
essenmitsosse c907c0a
refactor: merge button and tag button
essenmitsosse a2c3ff4
refactor: merge button and tag link
essenmitsosse 1c0a159
style: improve disabled design
essenmitsosse 585aa63
fix: link
essenmitsosse 83ae495
style: sync links and static tags
essenmitsosse 037638a
chore: move link to own folder
essenmitsosse 15bf1e3
refactor: rename link variants
essenmitsosse c84a978
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse 205c937
refactor: replace links with component
essenmitsosse 4974d56
fix: remove exclamation mark accidentally added
essenmitsosse 80bcd90
refactor: replace (almost) all links on package page
essenmitsosse cf33ca9
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse 260be92
feat: unifyied keyshort cut system
essenmitsosse 2278aa1
feat: unifyied icon system
essenmitsosse 886c60e
feat: automatically show external link icon
essenmitsosse b070507
feat: add button group
essenmitsosse bf06a1e
feat: automatically open all external links in new window
essenmitsosse 7b860d1
fix: layout
essenmitsosse 1bfa878
refactor: use design components for package sidebar
essenmitsosse 930a25e
refactor: use design components in footer build infos
essenmitsosse 1a8ba38
style: use accent colors for button and links
essenmitsosse a53e865
style: re-add unified focus style
essenmitsosse f0cc773
style: improve focus style
essenmitsosse 1a73f88
style: make buttons and links look clickable
essenmitsosse bc47aee
fix: minor fixes
essenmitsosse b52eec5
fix: l-to-r
essenmitsosse 9f8f1b8
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse f65280b
feat: add automatic anchor link design
essenmitsosse 858a8ab
test: update tests
essenmitsosse 314998f
fix: issue with types
essenmitsosse 392797e
fix: remove unnecessary border radius declaration
essenmitsosse f4cfdee
fix: typo
essenmitsosse 41ed66a
fix: update buton
essenmitsosse 95ef5d7
refactor: update button
essenmitsosse 3654cd4
fix: remove stale reference
essenmitsosse 1d2d1ba
refactor: streamline link props and change how external links are rec…
essenmitsosse 8992ed5
fix: prop name
essenmitsosse e70ef85
fix: remove unnecessary class
essenmitsosse ff7a8b6
fix: app header menu on mobile
essenmitsosse 5d23f56
style: move menu to button group
essenmitsosse 50486b5
test: ignore button group for a11y tests
essenmitsosse 45fdd71
fix: wrong element type
essenmitsosse edc4e21
refactoring
essenmitsosse e1a4e05
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse 54b044b
style: change package links back to link style
essenmitsosse e84b59c
test: fix copy-paste error with test props
essenmitsosse e96ae1a
[autofix.ci] apply automated fixes
autofix-ci[bot] 7ea5e19
fix: footer links
essenmitsosse 952a695
docs: add comment explaining explicit attr
essenmitsosse 042f468
refactor: rename tag variant
essenmitsosse c8420d2
refactor: change props for buttons and links
essenmitsosse 1fade1e
feat: remove non-working aria-current styling
essenmitsosse bed8f81
docs: update comment
essenmitsosse c0967c9
style: remove highlight border from buttons
essenmitsosse f5689dd
style: remove accent from links and buttons
essenmitsosse 77903fc
fix: firefox bug
essenmitsosse 784b8db
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse 2fce723
refactor: simplify query
essenmitsosse 62c88fc
refactor: change default element for button group
essenmitsosse 3a13fbf
docs: rephrase comment
essenmitsosse 899516f
fix: primary button in light mode
essenmitsosse 917d2d4
fix: wrong element type
essenmitsosse bf7c69d
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse a827403
WIP
essenmitsosse 1719728
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse 0bceba2
Revert "WIP"
essenmitsosse 3255a06
[autofix.ci] apply automated fixes
autofix-ci[bot] bcc1a2d
style: make links mono font again
essenmitsosse 4901f01
style: mute link underline more
essenmitsosse 702bbe9
style: reduce font size in footer
essenmitsosse 0d46806
style: use accent color for link hover
essenmitsosse 07127eb
refactor: use button icon for like button
essenmitsosse c1352d2
style: remove external link indicator from links that already have an…
essenmitsosse ea5c9fa
style: make deps info fit on single line
essenmitsosse a05c470
style: temporarily re-add button cursor pointer, for legacy buttons
essenmitsosse 0f9d174
fix: fix close button for modal
essenmitsosse 06d4847
style: dont hide underline on hover
essenmitsosse cd95139
style: reduce hover button contrast
essenmitsosse 4bf7b3a
Merge remote-tracking branch 'upstream/main' into fix-a11y-extract-bt…
essenmitsosse 1ae2a62
docs: fix typo
essenmitsosse e45e548
fix: remove unused import
essenmitsosse 4765ef1
style: add spacing around keyboard shortcut
essenmitsosse ecc87a3
style: revert menu back to old design while using new components
essenmitsosse 4ceb40e
fix: improve conditional rendering
essenmitsosse b323b78
fix: replace new button
essenmitsosse 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
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 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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <script setup lang="ts"> | ||
| const props = withDefaults( | ||
| defineProps<{ | ||
| 'disabled'?: boolean | ||
| 'type'?: 'button' | 'submit' | ||
| 'variant'?: 'primary' | 'secondary' | ||
| 'size'?: 'small' | 'medium' | ||
| 'keyshortcut'?: string | ||
|
|
||
| /** | ||
| * Do not use this directly. Use keyshortcut instead; it generates the correct HTML and displays the shortcut in the UI. | ||
| */ | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'aria-keyshortcuts'?: never | ||
essenmitsosse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 'classicon'?: string | ||
| }>(), | ||
| { | ||
| type: 'button', | ||
| variant: 'secondary', | ||
| size: 'medium', | ||
| }, | ||
| ) | ||
|
|
||
| const el = useTemplateRef('el') | ||
|
|
||
| defineExpose({ | ||
| focus: () => el.value?.focus(), | ||
| }) | ||
| </script> | ||
|
|
||
| <template> | ||
| <button | ||
| ref="el" | ||
| class="group cursor-pointer inline-flex gap-x-1 items-center justify-center font-mono border border-border rounded-md transition-all duration-200 disabled:(opacity-40 cursor-not-allowed border-transparent)" | ||
| :class="{ | ||
| 'text-sm px-4 py-2': size === 'medium', | ||
| 'text-xs px-2 py-0.5': size === 'small', | ||
| 'bg-transparent text-fg hover:enabled:(bg-fg/10) focus-visible:enabled:(bg-fg/10) aria-pressed:(bg-fg text-bg border-fg hover:enabled:(bg-fg text-bg/50))': | ||
| variant === 'secondary', | ||
| 'text-bg bg-fg hover:enabled:(bg-fg/50) focus-visible:enabled:(bg-fg/50) aria-pressed:(bg-fg text-bg border-fg hover:enabled:(text-bg/50))': | ||
| variant === 'primary', | ||
essenmitsosse marked this conversation as resolved.
Show resolved
Hide resolved
essenmitsosse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }" | ||
| :type="props.type" | ||
| :disabled=" | ||
| /** | ||
| * Unfortunately Vue _sometimes_ doesn't handle `disabled` correct, | ||
| * resulting in an invalid `disabled=false` attribute in the final HTML. | ||
| * | ||
| * This fixes this. | ||
| */ | ||
| disabled ? true : undefined | ||
| " | ||
| :aria-keyshortcuts="keyshortcut" | ||
| > | ||
| <span | ||
| v-if="classicon" | ||
| :class="[size === 'small' ? 'size-3' : 'size-4', classicon]" | ||
| aria-hidden="true" | ||
| /> | ||
| <slot /> | ||
| <kbd | ||
| v-if="keyshortcut" | ||
| class="ms-2 inline-flex items-center justify-center w-4 h-4 text-xs text-fg bg-bg-muted border border-border rounded no-underline" | ||
| aria-hidden="true" | ||
| > | ||
| {{ keyshortcut }} | ||
| </kbd> | ||
| </button> | ||
| </template> | ||
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <script setup lang="ts"> | ||
| const props = defineProps<{ | ||
| as?: string | Component | ||
| }>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <component | ||
| :is="props.as || 'div'" | ||
| class="flex items-center shrink-0 ms-auto [&>*:not(:first-child)]:rounded-s-none [&>*:not(:first-child)]:border-s-0 [&>*:not(:last-child)]:rounded-e-none" | ||
essenmitsosse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| > | ||
| <slot /> | ||
| </component> | ||
| </template> | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.