Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3487475
D3378.id10522.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.id10522.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
@@ -126,4 +126,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, 8:01 AM (21 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676046
Default Alt Text
D3378.id10522.diff (1 KB)
Attached To
Mode
D3378: [web] Introduce `Label` component
Attached
Detach File
Event Timeline
Log In to Comment