Squashed commit of the following:
commit 5e620f2d8576b08ebfee08e9781cd4927c4dcf2a
Merge: d82d5a902 679bbcdc2
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Jan 18 14:57:00 2021 +0300
Merge branch 'master' into 2554-mobile-install
commit d82d5a9028be0be72e612fc4c375d2be81c6c8c3
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Jan 18 14:09:25 2021 +0300
client: fix mobile layout for install page
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import React, { FC } from 'react';
|
|
import { Radio } from 'antd';
|
|
import { observer } from 'mobx-react-lite';
|
|
|
|
import s from './Radio.module.pcss';
|
|
|
|
const { Group } = Radio;
|
|
|
|
interface AdminInterfaceProps {
|
|
options: {
|
|
label: string;
|
|
desc?: string;
|
|
value: string | number;
|
|
}[];
|
|
onSelect: (value: string | number) => void;
|
|
value: string | number;
|
|
}
|
|
|
|
const RadioComponent: FC<AdminInterfaceProps> = observer(({
|
|
options, onSelect, value,
|
|
}) => {
|
|
if (options.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Group
|
|
value={value}
|
|
onChange={(e) => {
|
|
onSelect(e.target.value);
|
|
}}
|
|
className={s.group}
|
|
>
|
|
{options.map((o) => (
|
|
<Radio
|
|
key={o.value}
|
|
value={o.value}
|
|
className={s.radio}
|
|
>
|
|
<div>
|
|
{o.label}
|
|
</div>
|
|
{o.desc && (
|
|
<div className={s.desc}>
|
|
{o.desc}
|
|
</div>
|
|
)}
|
|
</Radio>
|
|
))}
|
|
</Group>
|
|
|
|
);
|
|
});
|
|
|
|
export default RadioComponent;
|