import { Row } from '@megafon/ui-core';
<Row title="Title" /> <Row title="Title" subTitle="Subtitle" href="#" backgroundView="stroke" showArrow> 300 ₽ </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />} showLoader backgroundView="stroke" /> <Row title="Title" subTitle="Subtitle" showArrow href="#"> <PromoBadge color="system-blue">Новое</PromoBadge> </Row> <Row title="Title" subTitle="Subtitle" showArrow href="#"> <CounterBadge currentValue={4} totalCount={8} hasIcon isAdaptive /> </Row> <Row title="Title" subTitle="Subtitle" showArrow href="#"> <NotificationBadge autoWidth>24 сообщения</NotificationBadge> </Row> <Row title="Title" icon={<AnimalIcon />}> <Button type="text"> Изменить </Button> </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored> <Switcher checked /> </Row> <Row title="Title" subTitle="Subtitle"> <Selector value="selector" checked /> </Row>
Big отличается от small размерами отступов и заголовка
<Row size="big" title="Big size (default)" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored showArrow > 300 ₽ </Row> <Row size="small" title="Small size" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored showArrow> 300 ₽ </Row>
<Row backgroundView="shadow" title="Shadow (default)" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored showArrow href="#" /> <Row backgroundView="stroke" title="Stroke" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored showArrow href="#" />
<Row title="Title" subTitle="Subtitle" showArrow href="#" /> <Row title="Title" subTitle="Subtitle"> 300 ₽ </Row>
<Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />} /> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored />
<Row showLoader title="Title" subTitle="Subtitle" /> <Row showLoader title="Title" subTitle="Subtitle" icon={<AnimalIcon />} /> <Row showLoader title="Title" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored />
<Row title="Title" subTitle="Subtitle"> <Button type="text">Изменить</Button> </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />}> <Button type="text">Изменить</Button> </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored> <Button type="text">Изменить</Button> </Row>
<Row title="Title" subTitle="Subtitle" showArrow href="#"> <PromoBadge color="system-blue">Новое</PromoBadge> </Row> <Row title="Title" subTitle="Subtitle" showArrow href="#"> <CounterBadge currentValue={4} totalCount={8} hasIcon isAdaptive /> </Row> <Row title="Title" subTitle="Subtitle" showArrow href="#"> <NotificationBadge autoWidth>24 сообщения</NotificationBadge> </Row>
Код SwitcherWrapperconst SwitcherWrapper = ({ children }) => {const [checked, setChecked] = React.useState<boolean>(false);const handleChange = () => {setChecked(!checked);};return <div style={blockStyle}>{children({ checked, onChange: handleChange })}</div>;};
<SwitcherWrapper> {({ onChange, checked }) => ( <> <Row title="Title" subTitle="Subtitle"> <Switcher checked={checked} onChange={onChange} /> </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />}> <Switcher showLoader checked /> </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored> <Switcher checked disabled /> </Row> </> )} </SwitcherWrapper>
Код SelectorWrapperconst SelectorWrapper = ({ children }) => {const [selectedOption, setSelectedOption] = React.useState<string>('1');const handleChange = (value: string): void => {setSelectedOption(value);};return <div style={blockStyle}>{children({ onChange: handleChange, selectedOption })}</div>;};
<SelectorWrapper> {({ onChange, selectedOption }) => ( <> <Row title="Title" subTitle="Subtitle"> <Selector value="1" checked={selectedOption === "1"} onChange={onChange} /> </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />}> <Selector value="2" checked={selectedOption === "2"} onChange={onChange} /> </Row> <Row title="Title" subTitle="Subtitle" icon={<AnimalIcon />} isIconColored> <Selector value="3" checked={selectedOption === "3"} onChange={onChange} /> </Row> </> )} </SelectorWrapper>