Skip to content

Commit

Permalink
Simplify npx record command by moving @latest to the clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonLaster committed Apr 28, 2024
1 parent 937c5e3 commit e6c730b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/app/components/hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function Hero({ hero }: LandingPageFragment) {
label={hero.installationLink.label || ''}
_id={hero.installationLink._id}
variant={hero.installationLink.variant || ''}
clipboard={hero.installationLink.clipboard}
className="w-full"
/>
<Link
Expand Down
6 changes: 4 additions & 2 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,21 @@ export function Button({
type ClipboardButtonProps = ButtonProps & {
label: string | null
_id: string | null
clipboard: string | null
}

export function ClipboardButton({
label,
color = 'default',
variant = 'solid',
clipboard,
...rest
}: ClipboardButtonProps) {
const [isCopied, setIsCopied] = useState(false)

const handleCopy = () => {
if (label !== null) {
navigator.clipboard.writeText(label)
if (clipboard !== null) {
navigator.clipboard.writeText(clipboard)
setIsCopied(true)
setTimeout(() => setIsCopied(false), 2400)
}
Expand Down
5 changes: 4 additions & 1 deletion src/lib/basehub-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export const linkFragment = fragmentOn('LinkComponent', {
export const landingPageFragment = fragmentOn('LandingPage', {
hero: {
getStartedLink: linkFragment,
installationLink: linkFragment,
installationLink: {
...linkFragment,
clipboard: true
},
contactUsLink: linkFragment,
logosTitle: true,
heroVariants: {
Expand Down

0 comments on commit e6c730b

Please sign in to comment.