-
-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
13 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 |
---|---|---|
@@ -1,25 +1,30 @@ | ||
import React, { ReactNode } from 'react'; | ||
import classNames from 'classnames'; | ||
import classnames from 'classnames'; | ||
|
||
interface TagProps { | ||
children: ReactNode; | ||
intent?: 'success' | 'warning' | 'error' | 'neutral'; | ||
} | ||
|
||
const Tag = ({ children, intent = 'neutral' }: TagProps) => { | ||
const appliedStyle = classNames( | ||
'inline-block rounded-full mr-2 px-3 py-1 text-[12px] font-semibold', | ||
{ | ||
'bg-green-50 text-green-700 border border-green-300': | ||
intent === 'success', | ||
'bg-yellow-50 text-yellow-700 border border-yellow-300': | ||
intent === 'warning', | ||
'bg-red-50 text-red-700 border border-red-300': intent === 'error', | ||
'bg-gray-50 text-gray-700 border border-gray-300': intent === 'neutral', | ||
}, | ||
return ( | ||
<div | ||
className={classnames( | ||
'inline-block rounded-full mr-2 px-3 py-1 text-[12px] font-semibold', | ||
{ | ||
'bg-green-50 text-green-700 border border-green-300': | ||
intent === 'success', | ||
'bg-yellow-50 text-yellow-700 border border-yellow-300': | ||
intent === 'warning', | ||
'bg-red-50 text-red-700 border border-red-300': intent === 'error', | ||
'bg-gray-50 text-gray-700 border border-gray-300': | ||
intent === 'neutral', | ||
}, | ||
)} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
return <div className={appliedStyle}>{children}</div>; | ||
}; | ||
|
||
export default Tag; |