Created
March 8, 2024 14:11
-
-
Save jacksonblankenship/cb7a6f4039a7b313d9421d0da0d0db72 to your computer and use it in GitHub Desktop.
Random Component
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
import { VariantProps, cva } from 'class-variance-authority'; | |
import { ComponentPropsWithoutRef, forwardRef } from 'react'; | |
import clsx from 'clsx'; | |
import styles from './EnvLabel.module.scss'; | |
export const envLabelCva = cva(styles.root, { | |
variants: { | |
environment: { | |
dev: styles.dev, | |
test: styles.test, | |
prod: styles.prod, | |
}, | |
}, | |
defaultVariants: {}, | |
}); | |
interface EnvLabelProps extends ComponentPropsWithoutRef<'span'>, VariantProps<typeof envLabelCva> {} | |
export const EnvLabel = forwardRef<HTMLSpanElement, EnvLabelProps>(({ className, environment, ...props }, ref) => ( | |
<span | |
{...props} | |
className={clsx(envLabelCva({ environment }), className)} | |
ref={ref}> | |
{environment} | |
</span> | |
)); | |
EnvLabel.displayName = 'EnvLabel'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment