Skip to content

Commit

Permalink
fix: missing fill option in badge component (#17)
Browse files Browse the repository at this point in the history
* fix: missing fill option in badge component

* fix: input size prop conflict with size variant
  • Loading branch information
ajbura authored May 7, 2023
1 parent cdb9ae4 commit e021107
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/components/badge/Badge.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export const Badge = recipe({
color: OnContainer,
borderColor: ContainerLine,
},
None: {
backgroundColor: "inherit",
color: Main,
borderColor: Main,
},
},
outlined: {
true: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/Badge.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
},
fill: {
control: "select",
options: ["Solid", "Soft"],
options: ["Solid", "Soft", "None"],
},
},
} as ComponentMeta<typeof Badge>;
Expand Down
10 changes: 7 additions & 3 deletions src/components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ import React, { AllHTMLAttributes, forwardRef, ReactNode } from "react";
import classNames from "classnames";
import * as css from "./Input.css";

type InputProps = AllHTMLAttributes<HTMLInputElement> & {
type InputProps = Omit<AllHTMLAttributes<HTMLInputElement>, "size"> & {
before?: ReactNode;
after?: ReactNode;
inputSize?: number;
};

export const Input = forwardRef<HTMLInputElement, InputProps & css.InputVariants>(
({ className, style, variant, size, outlined, radii, before, after, ...props }, ref) => (
(
{ className, style, variant, size, inputSize = 1, outlined, radii, before, after, ...props },
ref
) => (
<div
className={classNames(css.Input({ variant, size, outlined, radii }), className)}
style={style}
data-ui-before={before ? true : undefined}
data-ui-after={after ? true : undefined}
>
{before}
<input className={css.InputInput} {...props} ref={ref} />
<input className={css.InputInput} size={inputSize} {...props} ref={ref} />
{after}
</div>
)
Expand Down

0 comments on commit e021107

Please sign in to comment.