Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33185820
label.react.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
995 B
Referenced Files
None
Subscribers
None
label.react.js
View Options
// @flow
import
*
as
React
from
'react'
;
import
SWMansionIcon
from
'../SWMansionIcon.react'
;
import
css
from
'./label.css'
;
type
Props
=
{
+
size
?:
string
|
number
,
+
color
?:
string
,
+
bg
?:
string
,
+
children
:
React
.
Node
,
+
onClose
?:
()
=>
mixed
,
};
function
Label
(
props
:
Props
)
:
React
.
Node
{
const
{
size
=
'12px'
,
color
=
'var(--label-default-color)'
,
bg
=
'var(--label-default-bg)'
,
children
,
onClose
,
}
=
props
;
const
labelStyle
=
React
.
useMemo
(
()
=>
({
fontSize
:
size
,
color
:
color
,
background
:
bg
,
}),
[
bg
,
color
,
size
],
);
const
closeButton
=
React
.
useMemo
(()
=>
{
if
(
!
onClose
)
{
return
null
;
}
return
(
<
button
className
=
{
css
.
close
}
onClick
=
{
onClose
}
>
<
SWMansionIcon
icon
=
"cross"
size
=
{
size
}
/>
<
/button>
);
},
[
onClose
,
size
]);
return
(
<
div
style
=
{
labelStyle
}
className
=
{
css
.
label
}
>
{
children
}
{
closeButton
}
<
/div>
);
}
export
default
Label
;
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Jan 17, 3:36 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5924583
Default Alt Text
label.react.js (995 B)
Attached To
Mode
rCOMM Comm
Attached
Detach File
Event Timeline
Log In to Comment