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:
parent
7b9712db9a
commit
9208aee684
1 changed files with 27 additions and 0 deletions
|
@ -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;
|
Loading…
Add table
Reference in a new issue