diff --git a/app/docs/components/button/button.mdx b/app/docs/components/button/button.mdx index 89a03d11..258988ce 100644 --- a/app/docs/components/button/button.mdx +++ b/app/docs/components/button/button.mdx @@ -1,6 +1,7 @@ import { KeepButtonTypeCode, KeepButtonType } from './variant/KeepButtonType' import { KeepButtonColor, KeepButtonColorCode } from './variant/KeepButtonColor' import { KeepButtonSize, KeepButtonSizeCode } from './variant/KeepButtonSize' +import { KeepButtonLink, KeepButtonLinkCode } from './variant/KeepButtonLink' import { KeepButtonShape, KeepButtonShapeCode } from './variant/KeepButtonShape' import { KeepButtonIcon, KeepButtonIconCode } from './variant/KeepButtonIcon' import { DefaultButton, DefaultButtonCode } from './variant/DefaultButton' @@ -29,6 +30,14 @@ You can customize your buttons with different color schemes to match your design +## Button with link + +You can add a link to a button component by passing asChild props. + + + + + ## Button Variant Type Choose from different button types depending on your use case. The available types include: `default` `softBg` `outline` and `link`. diff --git a/app/docs/components/button/buttonApi.ts b/app/docs/components/button/buttonApi.ts index 7fb86369..354c05fa 100644 --- a/app/docs/components/button/buttonApi.ts +++ b/app/docs/components/button/buttonApi.ts @@ -41,4 +41,11 @@ export const buttonApiData = [ propsDescription: 'Size variant of the button.', default: 'md', }, + { + id: 7, + propsName: 'asChild', + propsType: ['true', 'false'], + propsDescription: 'Set button styles and functionality to her child component.', + default: 'false', + }, ] diff --git a/app/docs/components/button/variant/KeepButtonLink.tsx b/app/docs/components/button/variant/KeepButtonLink.tsx new file mode 100644 index 00000000..2a0b9b6b --- /dev/null +++ b/app/docs/components/button/variant/KeepButtonLink.tsx @@ -0,0 +1,29 @@ +'use client' +import Link from 'next/link' +import { Button } from '../../../../src' + +const KeepButtonLink = () => { + return ( +
+ +
+ ) +} + +const KeepButtonLinkCode = { + 'ButtonComponent.tsx': ` +import { Button } from 'keep-react' + +export const ButtonComponent = () => { + return ( + + ) +} +`, +} + +export { KeepButtonLink, KeepButtonLinkCode } diff --git a/app/docs/components/modal/variant/DefaultModal.tsx b/app/docs/components/modal/variant/DefaultModal.tsx index 32c36919..e594c1a7 100644 --- a/app/docs/components/modal/variant/DefaultModal.tsx +++ b/app/docs/components/modal/variant/DefaultModal.tsx @@ -4,6 +4,7 @@ import { Button, Modal, ModalAction, + ModalClose, ModalContent, ModalDescription, ModalFooter, @@ -31,7 +32,9 @@ const DefaultModal = () => { - + + + diff --git a/app/src/components/Button/Button.tsx b/app/src/components/Button/Button.tsx index c56f37a7..1a7dcd9b 100644 --- a/app/src/components/Button/Button.tsx +++ b/app/src/components/Button/Button.tsx @@ -1,5 +1,6 @@ 'use client' import { ButtonHTMLAttributes, Ref, forwardRef } from 'react' +import { Slot } from '@radix-ui/react-slot' import { cn } from '../../utils/cn' import { ButtonColorVariant, ButtonSizeVariant, buttonVariants } from './theme' @@ -9,6 +10,7 @@ export interface ButtonProps extends ButtonHTMLAttributes { variant?: 'link' | 'outline' | 'softBg' | 'default' shape?: 'circle' | 'icon' position?: 'start' | 'end' | 'center' + asChild?: boolean radius?: 'default' | 'full' } @@ -22,18 +24,20 @@ const Button = forwardRef( variant = 'default', radius = 'default', shape, + asChild = false, position, ...props }, ref: Ref, ) => { + const Comp = asChild ? Slot : 'button' return ( - + ) }, ) diff --git a/app/src/components/Modal/index.tsx b/app/src/components/Modal/index.tsx index 0104da69..1c2ec495 100644 --- a/app/src/components/Modal/index.tsx +++ b/app/src/components/Modal/index.tsx @@ -1,5 +1,5 @@ 'use client' -import { Portal, Trigger } from '@radix-ui/react-dialog' +import { Close, Portal, Trigger } from '@radix-ui/react-dialog' import type { ModalProps } from './Modal' import { Modal } from './Modal' import { ModalContent } from './ModalContent' @@ -11,9 +11,11 @@ import { ModalTitle } from './ModalTitle' const ModalAction = Trigger const ModalPortal = Portal +const ModalClose = Close export { Modal, + ModalClose, ModalAction, ModalContent, ModalDescription, diff --git a/app/src/components/Upload/Body.tsx b/app/src/components/Upload/Body.tsx index e9aee759..aa8b055d 100644 --- a/app/src/components/Upload/Body.tsx +++ b/app/src/components/Upload/Body.tsx @@ -7,16 +7,17 @@ import { useUploadContext } from './UploadContext' const UploadBody = forwardRef>( ({ children, className, ...props }, ref: Ref) => { const { options, horizontal } = useUploadContext() - const { getRootProps, getInputProps } = useDropzone(options) + const { getRootProps, getInputProps, isDragActive, isDragReject } = useDropzone(options) return (