This repository has been archived by the owner on Jan 31, 2023. It is now read-only.
forked from electricitymaps/electricitymaps-contrib
-
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.
- Loading branch information
1 parent
d8430a0
commit b2890c6
Showing
5 changed files
with
48 additions
and
25 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,25 @@ | ||
type BadgeProps = { | ||
children: string; | ||
type?: 'default' | 'warning'; | ||
className?: string; | ||
}; | ||
|
||
export default function Badge({ children, type = 'default', className }: BadgeProps) { | ||
// set background and text color classes depending on type | ||
const bgColorClasses = { | ||
default: 'bg-gray-300 dark:bg-gray-400', | ||
warning: 'bg-yellow-400 dark:bg-yellow-500', | ||
}[type]; | ||
const textColorClasses = { | ||
default: 'text-gray-800/75 dark:text-gray-900', | ||
warning: 'text-yellow-900/95 dark:text-gray-900/95', | ||
}[type]; | ||
|
||
return ( | ||
<span | ||
className={`rounded-full py-[1px] px-2 text-xs font-medium ${bgColorClasses} ${textColorClasses} ${className}`} | ||
> | ||
{children} | ||
</span> | ||
); | ||
} |
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