Skip to content

Commit

Permalink
🎨 improve badge with capitalize
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineKM committed Apr 2, 2023
1 parent bd30326 commit 6f7d3a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/thirty-spies-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tonightpass/kitchen": patch
---

Improve `Badge` with capitalize
11 changes: 9 additions & 2 deletions packages/kitchen/src/components/Badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import styled from "styled-components";
import withScale from "../../hoc/withScale";
import { KitchenComponent, NormalSizes } from "../../types";
import { capitalize, isString } from "../..";

type Props = {
/**
Expand All @@ -24,8 +25,14 @@ type Props = {

export type BadgeProps = KitchenComponent<Props>;

const Badge = styled((props: BadgeProps) => {
return <span {...props} />;
const Badge = styled(({ children, ...props }: BadgeProps) => {
return (
<span {...props}>
{children && isString(children)
? capitalize(children as string)
: children}
</span>
);
})<BadgeProps>`
box-sizing: border-box;
display: inline-flex;
Expand Down

3 comments on commit 6f7d3a1

@vercel
Copy link

@vercel vercel bot commented on 6f7d3a1 Apr 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 6f7d3a1 Apr 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kitchen-react-typescript – ./examples/react-typescript

kitchen-react-typescript-onruntime.vercel.app
kitchen-react-typescript.vercel.app
kitchen-react-typescript-git-master-onruntime.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 6f7d3a1 Apr 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kitchen-workshop – ./workshop

kitchen-workshop-git-master-onruntime.vercel.app
kitchen-workshop-onruntime.vercel.app
kitchen-workshop.vercel.app

Please sign in to comment.