Skip to content

Commit

Permalink
fix(): Replace transparent background with background.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Sep 30, 2024
1 parent 92e538b commit 3d5c992
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 268 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-background"
: "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>
);
};
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-background 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-background 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
14 changes: 7 additions & 7 deletions src/shadcn/ui/input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react"
import * as React from "react";

import { cn } from "src/utils"
import { cn } from "src/utils";

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
Expand All @@ -11,15 +11,15 @@ 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:bg-transparent 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-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-background 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}
{...props}
/>
)
);
}
)
Input.displayName = "Input"
);
Input.displayName = "Input";

export { Input }
export { Input };
Loading

0 comments on commit 3d5c992

Please sign in to comment.