Skip to content
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
1 change: 1 addition & 0 deletions js/react/lib/components/radio/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./radio.component";
22 changes: 22 additions & 0 deletions js/react/lib/components/radio/radio.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { cn } from "@/utils/tw-merge";
import { InputHTMLAttributes } from "react";

type RadioProps = InputHTMLAttributes<HTMLInputElement>;

export const Radio = ({ className, ...rest }: RadioProps) => {
return (
<input
className={cn([
"shadow-rb-black aspect-square appearance-none transition",
"flex size-4 items-center justify-center rounded-full border border-black",
"after:absolute after:size-2 after:rounded-full after:transition",
"dark:bg-dark bg-white",
"after:bg-gray dark:after:bg-neutral-500",
"checked:after:bg-primary-500",
className,
])}
type="radio"
{...rest}
/>
);
};
1 change: 1 addition & 0 deletions js/react/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export * from "./components/flap";
export * from "./components/level";
export * from "./components/avatar";
export * from "./components/collaborators";
export * from "./components/radio";
export * from "./icons";
1 change: 1 addition & 0 deletions js/react/lib/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@

--color-light: #fafafa;
--color-dark: #2e2e2e;
--color-gray: #D9D9D9;

/* Fonts */
--text-xxs: 10px;
Expand Down
12 changes: 12 additions & 0 deletions js/react/showcase/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Chip,
Level,
Collaborators,
Radio,
} from "@rustlanges/react";
import { ShowComponent } from "./ShowComponent";

Expand Down Expand Up @@ -207,6 +208,17 @@ export function App() {
</div>
</div>
</ShowComponent>
<ShowComponent
title="Radio"
component={Radio}
propsDef={{
checked: {
type: "boolean",
default: false,
optional: true,
},
}}
/>
</div>
);
}