Skip to content

Commit

Permalink
fix(): Replace bg-transpernt with card.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Sep 26, 2024
1 parent b60e80c commit 28f770c
Show file tree
Hide file tree
Showing 11 changed files with 271 additions and 269 deletions.
50 changes: 29 additions & 21 deletions src/custom/docs/components/header/CodeCopy.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
'use client'
import React from "react"
"use client";
import React from "react";

import {Button, cn} from 'src'
import { Check, Copy } from "lucide-react"
export const CodeCopy = (props: {textToCopy: string, className?: string}) => {
import { Button, cn } from "src";
import { Check, Copy } from "lucide-react";
export const CodeCopy = (props: { textToCopy: string; className?: string }) => {
const [copied, setHasCopied] = React.useState(false);

const [copied, setHasCopied] = React.useState(false)

return <div className="dark:text-foreground text-background w-full flex items-center justify-center self-start whitespace-nowrap rounded bg-gradient-to-r from-zinc-600 to-slate-600 py-0.5 pl-4 text-center text-sm font-semibold dark:from-zinc-600 dark:to-slate-600">
<code className="font-mono">{props.textToCopy}</code>
return (
<div className='dark:text-foreground text-background w-full flex items-center justify-center self-start whitespace-nowrap rounded bg-gradient-to-r from-zinc-600 to-slate-600 py-0.5 pl-4 text-center text-sm font-semibold dark:from-zinc-600 dark:to-slate-600'>
<code className='font-mono'>{props.textToCopy}</code>

<Button
variant="ghost"
size="icon"
className={cn(`${copied ? ' hover:bg-transparent' : 'hover:bg-background/50 hover:text-foreground/75'} ml-1`, props.className)}
<Button
variant='ghost'
size='icon'
className={cn(
`${
copied
? " hover:bg-card"
: "hover:bg-background/50 hover:text-foreground/75"
} ml-1`,
props.className
)}
onClick={() => {
window.navigator.clipboard.writeText(props.textToCopy)
setHasCopied(true)
window.navigator.clipboard.writeText(props.textToCopy);
setHasCopied(true);
setTimeout(() => {
setHasCopied(false)
}, 2500)
setHasCopied(false);
}, 2500);
}}
>
{copied ? (
<Check className="text-background h-5 w-5"></Check>
<Check className='text-background h-5 w-5'></Check>
) : (
<Copy className="aspect-square h-4 w-4"></Copy>
<Copy className='aspect-square h-4 w-4'></Copy>
)}
</Button>
</div>
}
</div>
);
};
2 changes: 1 addition & 1 deletion src/shadcn/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const buttonVariants = cva(
destructive:
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
outline:
"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",
"border border-input bg-card shadow-sm hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
Expand Down
6 changes: 3 additions & 3 deletions src/shadcn/ui/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Calendar({
nav: "space-x-1 flex items-center",
nav_button: cn(
buttonVariants({ variant: "outline" }),
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
"h-7 w-7 bg-card p-0 opacity-50 hover:opacity-100"
),
nav_button_previous: "absolute left-1",
nav_button_next: "absolute right-1",
Expand Down Expand Up @@ -60,8 +60,8 @@ function Calendar({
...classNames,
}}
components={{
IconLeft: ({ ...props }) => <ChevronLeftIcon className="h-4 w-4" />,
IconRight: ({ ...props }) => <ChevronRightIcon className="h-4 w-4" />,
IconLeft: ({ ...props }) => <ChevronLeftIcon className='h-4 w-4' />,
IconRight: ({ ...props }) => <ChevronRightIcon className='h-4 w-4' />,
}}
{...props}
/>
Expand Down
16 changes: 8 additions & 8 deletions src/shadcn/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ interface CommandDialogProps extends DialogProps {}
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0">
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
<DialogContent className='overflow-hidden p-0'>
<Command className='[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5'>
{children}
</Command>
</DialogContent>
Expand All @@ -41,12 +41,12 @@ const CommandInput = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Input>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
>(({ className, ...props }, ref) => (
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
<MagnifyingGlassIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
<div className='flex items-center border-b px-3' cmdk-input-wrapper=''>
<MagnifyingGlassIcon className='mr-2 h-4 w-4 shrink-0 opacity-50' />
<CommandPrimitive.Input
ref={ref}
className={cn(
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
"flex h-10 w-full rounded-md bg-card py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
Expand Down Expand Up @@ -75,7 +75,7 @@ const CommandEmpty = React.forwardRef<
>((props, ref) => (
<CommandPrimitive.Empty
ref={ref}
className="py-6 text-center text-sm"
className='py-6 text-center text-sm'
{...props}
/>
));
Expand Down Expand Up @@ -117,8 +117,8 @@ const CommandItem = React.forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50',
props.disabled ? 'opacity-50 pointer-events-none' : '',
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
props.disabled ? "opacity-50 pointer-events-none" : "",
className
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/shadcn/ui/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input
type={type}
className={cn(
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
"flex h-9 w-full rounded-md border border-input bg-card px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
Expand Down
Loading

0 comments on commit 28f770c

Please sign in to comment.