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

Update Badge component to match latest Figma #260

Merged
merged 2 commits into from
Oct 10, 2024
Merged
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 26 additions & 8 deletions src/components/Badge/Badge.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,34 @@ limitations under the License.
align-items: center;
border-radius: 9999px; /* pill effect */
padding: var(--cpd-space-1x) var(--cpd-space-3x);
background: var(--cpd-color-gray-400);
color: var(--cpd-color-text-secondary);
}

.badge[data-kind="success"] {
background: var(--cpd-color-green-400);
color: var(--cpd-color-green-900);
.badge[data-kind="default"] {
border: 1px solid var(--cpd-color-alpha-gray-400);
color: var(--cpd-color-gray-1100);
}

.badge[data-kind="critical"] {
background: var(--cpd-color-red-400);
color: var(--cpd-color-red-900);
.badge[data-kind="grey"] {
background: var(--cpd-color-alpha-gray-300);
color: var(--cpd-color-gray-1100);
}

.badge[data-kind="on-solid"] {
background: var(--cpd-color-alpha-gray-1200);
color: var(--cpd-color-text-on-solid-primary);
}

.badge[data-kind="blue"] {
background: var(--cpd-color-alpha-blue-300);
color: var(--cpd-color-blue-1100);
}

.badge[data-kind="green"] {
background: var(--cpd-color-alpha-green-300);
color: var(--cpd-color-green-1100);
}

.badge[data-kind="red"] {
background: var(--cpd-color-alpha-red-300);
color: var(--cpd-color-red-1100);
}
30 changes: 23 additions & 7 deletions src/components/Badge/Badge.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,29 @@ export default {
} as Meta<typeof BadgeComponent>;

const Template: StoryFn<typeof BadgeComponent> = () => (
<>
<BadgeComponent kind="success">Trusted</BadgeComponent>
&nbsp;
<BadgeComponent kind="critical">Not trusted</BadgeComponent>
&nbsp;
<BadgeComponent kind="default">Public room</BadgeComponent>
</>
<div>
<div>
<BadgeComponent kind="green">Trusted</BadgeComponent>
&nbsp;
<BadgeComponent kind="red">Not trusted</BadgeComponent>
&nbsp;
<BadgeComponent kind="grey">Public room</BadgeComponent>
</div>
<br />
<div>
<BadgeComponent kind="default">Default</BadgeComponent>
&nbsp;
<BadgeComponent kind="grey">Grey</BadgeComponent>
&nbsp;
<BadgeComponent kind="on-solid">On Solid</BadgeComponent>
&nbsp;
<BadgeComponent kind="blue">Blue</BadgeComponent>
&nbsp;
<BadgeComponent kind="green">Green</BadgeComponent>
&nbsp;
<BadgeComponent kind="red">Red</BadgeComponent>
</div>
</div>
);

export const Badge = Template.bind({});
Expand Down
2 changes: 1 addition & 1 deletion src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type BadgeProps = {
/**
* The type of badge.
*/
kind?: "default" | "success" | "critical";
kind?: "default" | "grey" | "on-solid" | "blue" | "green" | "red";
};

/**
Expand Down
Loading