0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

feat(console): add CardSelector component for cloud preview (#3085)

This commit is contained in:
Xiao Yijun 2023-02-09 18:07:49 +08:00 committed by GitHub
parent 7b9712db9a
commit 9208aee684
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,27 @@
import type { AdminConsoleKey } from '@logto/phrases';
import type { ReactNode } from 'react';
import RadioGroup, { Radio } from '@/components/RadioGroup';
export type Option = {
icon?: ReactNode;
title: AdminConsoleKey;
value: string;
};
type Props = {
name: string;
value: string;
options: Option[];
onChange: (value: string) => void;
};
const CardSelector = ({ name, value, options, onChange }: Props) => (
<RadioGroup type="compact" value={value} name={name} onChange={onChange}>
{options.map(({ value: optionValue, title, icon }) => (
<Radio key={optionValue} icon={icon} title={title} value={optionValue} />
))}
</RadioGroup>
);
export default CardSelector;