Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: LEAP-1907: Migrate EnterpriseBadge to UI library #7173

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions web/apps/labelstudio/src/components/Badges/Enterprise.scss

This file was deleted.

17 changes: 0 additions & 17 deletions web/apps/labelstudio/src/components/Badges/Enterprise.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { EnterpriseBadge } from "@humansignal/ui";
import React from "react";
import { useHistory } from "react-router";
import { Button, ToggleItems } from "../../components";
Expand All @@ -12,7 +13,6 @@ import { ImportPage } from "./Import/Import";
import { useImportPage } from "./Import/useImportPage";
import { useDraftProject } from "./utils/useDraftProject";
import { Input, Select, TextArea } from "../../components/Form";
import { EnterpriseBadge } from "../../components/Badges/Enterprise";
import { Caption } from "../../components/Caption/Caption";
import { FF_LSDV_E_297, isFF } from "../../utils/feature-flags";
import { createURL } from "../../components/HeidiTips/utils";
Expand Down Expand Up @@ -53,7 +53,7 @@ const ProjectName = ({ name, setName, onSaveName, onSubmit, error, description,
<div className="field field--wide">
<label>
Workspace
<EnterpriseBadge />
<EnterpriseBadge className="ml-2" />
</label>
<Select placeholder="Select an option" disabled options={[]} />
<Caption>
Expand Down
6 changes: 3 additions & 3 deletions web/apps/labelstudio/src/pages/Settings/GeneralSettings.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { EnterpriseBadge } from "@humansignal/ui";
import { useCallback, useContext } from "react";
import { Button } from "../../components";
import { Form, Input, Select, TextArea } from "../../components/Form";
import { RadioGroup } from "../../components/Form/Elements/RadioGroup/RadioGroup";
import { ProjectContext } from "../../providers/ProjectProvider";
import { Block, Elem } from "../../utils/bem";
import { EnterpriseBadge } from "../../components/Badges/Enterprise";
import "./settings.scss";
import { HeidiTips } from "../../components/HeidiTips/HeidiTips";
import { FF_LSDV_E_297, isFF } from "../../utils/feature-flags";
Expand Down Expand Up @@ -39,7 +39,7 @@ export const GeneralSettings = () => {
<Block name="workspace-placeholder">
<Elem name="badge-wrapper">
<Elem name="title">Workspace</Elem>
<EnterpriseBadge />
<EnterpriseBadge className="ml-2" />
</Elem>
<Select placeholder="Select an option" disabled options={[]} />
<Caption>
Expand Down Expand Up @@ -83,7 +83,7 @@ export const GeneralSettings = () => {
value=""
label={
<>
Uncertainty sampling <EnterpriseBadge />
Uncertainty sampling <EnterpriseBadge className="ml-2" />
</>
}
disabled
Expand Down
1 change: 1 addition & 0 deletions web/libs/ui/src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export { ReactComponent as IconUpload } from "./upload.svg";
export { ReactComponent as IconLaunch } from "./launch.svg";
export { ReactComponent as IconFileCopy } from "./file-copy.svg";
export { ReactComponent as IconWarning } from "./warning.svg";
export { ReactComponent as IconSpark } from "./spark.svg";
12 changes: 12 additions & 0 deletions web/libs/ui/src/assets/icons/spark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions web/libs/ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./lib/enterprise-badge/enterprise-badge";
export * from "./lib/checkbox/checkbox";
export * from "./lib/toast/toast";
export * from "./lib/InputFile/InputFile";
Expand Down
34 changes: 34 additions & 0 deletions web/libs/ui/src/lib/enterprise-badge/enterprise-badge.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.badge {
display: inline-block;
border-radius: 4px;
background: linear-gradient(135deg, #FFA663 0%, #FF7557 51.56%, #E37BD3 100%);
vertical-align: middle;
height: 20px;
}

.filled {
.label {
background: none;
color: var(--persimmon_0);
}

.icon {
path {
fill: var(--persimmon_0);
}
}
}

.label {
margin: 1px;
background: var(--persimmon_0);
color: var(--persimmon_400);
border-radius: 3px;
font-size: 11px;
padding: 2px 5px 2px 3px;
display: flex;
gap: 4px;
align-items: center;
line-height: 100%;
font-weight: 500;
}
24 changes: 24 additions & 0 deletions web/libs/ui/src/lib/enterprise-badge/enterprise-badge.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Meta, StoryObj } from "@storybook/react";
import { EnterpriseBadge } from "./enterprise-badge";

const meta: Meta<typeof EnterpriseBadge> = {
component: EnterpriseBadge,
title: "EnterpriseBadge",
tags: ["autodocs"],
argTypes: {
filled: { control: "boolean" },
},
};

export default meta;
type Story = StoryObj<typeof EnterpriseBadge>;

export const Default: Story = {
args: {},
};

export const Filled: Story = {
args: {
filled: true,
},
};
23 changes: 23 additions & 0 deletions web/libs/ui/src/lib/enterprise-badge/enterprise-badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import clsx from "clsx";
import type { FC } from "react";
import { IconSpark } from "../../assets/icons";
import styles from "./enterprise-badge.module.scss";

/* eslint-disable-next-line */
export interface EnterpriseBadgeProps {
className?: string;
filled?: boolean;
}

export const EnterpriseBadge: FC<EnterpriseBadgeProps> = ({ className, filled }) => {
return (
<div className={clsx(styles.badge, { [styles.filled]: filled }, className)}>
<div className={clsx(styles.label)}>
<IconSpark className={clsx(styles.icon)} />
Enterprise
</div>
</div>
);
};

export default EnterpriseBadge;
Loading