Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3486346
D3378.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3378.diff
View Options
diff --git a/web/components/label.css b/web/components/label.css
new file mode 100644
--- /dev/null
+++ b/web/components/label.css
@@ -0,0 +1,5 @@
+div.label {
+ line-height: 1.5;
+ padding: 4px 8px;
+ border-radius: 8px;
+}
diff --git a/web/components/label.react.js b/web/components/label.react.js
new file mode 100644
--- /dev/null
+++ b/web/components/label.react.js
@@ -0,0 +1,38 @@
+// @flow
+
+import * as React from 'react';
+
+import css from './label.css';
+
+type Props = {
+ +size?: string | number,
+ +color?: string,
+ +bg?: string,
+ +children: React.Node,
+};
+
+function Label(props: Props): React.Node {
+ const {
+ size = '12px',
+ color = 'var(--label-default-color)',
+ bg = 'var(--label-default-bg)',
+ children,
+ } = props;
+
+ const labelStyle = React.useMemo(
+ () => ({
+ fontSize: size,
+ color: color,
+ background: bg,
+ }),
+ [bg, color, size],
+ );
+
+ return (
+ <div style={labelStyle} className={css.label}>
+ {children}
+ </div>
+ );
+}
+
+export default Label;
diff --git a/web/theme.css b/web/theme.css
--- a/web/theme.css
+++ b/web/theme.css
@@ -132,4 +132,6 @@
--tabs-header-background-border: var(--shades-black-80);
--tabs-header-background-color-hover: var(--shades-white-80);
--tabs-header-background-border-hover: var(--shades-black-70);
+ --label-default-bg: var(--violet-dark-80);
+ --label-default-color: var(--shades-white-80);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 4:40 AM (20 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675309
Default Alt Text
D3378.diff (1 KB)
Attached To
Mode
D3378: [web] Introduce `Label` component
Attached
Detach File
Event Timeline
Log In to Comment