forked from NangoHQ/nango
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): upgrade Info component with Radix (NangoHQ#2645)
## Describe your changes Contributes to https://linear.app/nango/issue/NAN-1537/script-v2-integrate-ui - Upgrade Info component with Radix
- Loading branch information
1 parent
82e7a90
commit 96c1c1f
Showing
17 changed files
with
106 additions
and
98 deletions.
There are no files selected for viewing
This file contains 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,24 @@ | ||
import type React from 'react'; | ||
import { Alert, AlertDescription, AlertTitle } from './ui/Alert'; | ||
import { InfoCircledIcon } from '@radix-ui/react-icons'; | ||
import type { ComponentProps } from 'react'; | ||
import { cn } from '../utils/utils'; | ||
|
||
export const Info: React.FC<{ children: React.ReactNode; title?: string } & ComponentProps<typeof Alert>> = ({ children, title, ...props }) => { | ||
return ( | ||
<Alert variant={'default'} {...props}> | ||
<div | ||
className={cn( | ||
'rounded-full p-1', | ||
props.variant === 'destructive' && 'bg-red-base-35', | ||
props.variant === 'warning' && 'bg-yellow-base-35', | ||
(!props.variant || props.variant === 'default') && 'bg-blue-base-35' | ||
)} | ||
> | ||
<InfoCircledIcon className="h-4 w-4" /> | ||
</div> | ||
{title && <AlertTitle>{title}</AlertTitle>} | ||
<AlertDescription>{children}</AlertDescription> | ||
</Alert> | ||
); | ||
}; |
This file contains 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 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,34 @@ | ||
import * as React from 'react'; | ||
import { cva } from 'class-variance-authority'; | ||
import type { VariantProps } from 'class-variance-authority'; | ||
import { cn } from '../../utils/utils'; | ||
|
||
const alertVariants = cva('relative w-full rounded-lg border px-3 py-1.5 text-sm flex gap-2 items-center', { | ||
variants: { | ||
variant: { | ||
default: 'bg-blue-base-35 border-blue-base text-blue-base', | ||
destructive: 'bg-red-base-35 border-red-base text-red-base', | ||
warning: 'bg-yellow-base-35 border-yellow-base text-yellow-base' | ||
} | ||
}, | ||
defaultVariants: { | ||
variant: 'default' | ||
} | ||
}); | ||
|
||
const Alert = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>>( | ||
({ className, variant, ...props }, ref) => <div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} /> | ||
); | ||
Alert.displayName = 'Alert'; | ||
|
||
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(({ className, ...props }, ref) => ( | ||
<h5 ref={ref} className={cn('mb-1 font-medium leading-none tracking-tight', className)} {...props} /> | ||
)); | ||
AlertTitle.displayName = 'AlertTitle'; | ||
|
||
const AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({ className, ...props }, ref) => ( | ||
<div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} /> | ||
)); | ||
AlertDescription.displayName = 'AlertDescription'; | ||
|
||
export { Alert, AlertTitle, AlertDescription }; |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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 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 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.