-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(anni): extract label as generic component
- Loading branch information
1 parent
b594e42
commit 1d5d687
Showing
2 changed files
with
25 additions
and
5 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,20 @@ | ||
import { createElement, ElementType } from 'react'; | ||
|
||
interface Props<T> extends React.HTMLAttributes<T> { | ||
as?: ElementType; | ||
title: string; | ||
} | ||
|
||
function Label<T>({ as: parent, title, ...additionalProps }: Props<T>) { | ||
return createElement( | ||
parent ?? 'span', | ||
{ | ||
className: | ||
'border border-black border-opacity-20 text-xs px-2 rounded-full whitespace-nowrap font-semibold align-text-top mr-2', | ||
...additionalProps, | ||
}, | ||
title, | ||
); | ||
} | ||
|
||
export default Label; |
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