feat: first commit
This commit is contained in:
21
src/components/bl-checkbox/index.less
Normal file
21
src/components/bl-checkbox/index.less
Normal file
@ -0,0 +1,21 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.profile-checkbox {
|
||||
|
||||
&__group {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.flex-row();
|
||||
}
|
||||
|
||||
&__item {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
}
|
43
src/components/bl-checkbox/index.tsx
Normal file
43
src/components/bl-checkbox/index.tsx
Normal file
@ -0,0 +1,43 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
|
||||
import { Checkbox } from '@taroify/core';
|
||||
import { CheckboxProps, CheckboxGroupProps } from '@taroify/core/checkbox';
|
||||
|
||||
import './index.less';
|
||||
|
||||
interface IProps extends CheckboxProps {
|
||||
text: string;
|
||||
value: BL.Anything[];
|
||||
}
|
||||
|
||||
interface IGroupProps extends CheckboxGroupProps {}
|
||||
|
||||
const PREFIX = 'profile-checkbox';
|
||||
|
||||
export function BlCheckboxGroup(props: IGroupProps) {
|
||||
return <Checkbox.Group className={`${PREFIX}__group`} direction="horizontal" {...props} />;
|
||||
}
|
||||
|
||||
export function BlCheckbox(props: IProps) {
|
||||
const { name, text, value } = props;
|
||||
|
||||
return (
|
||||
<Checkbox
|
||||
className={`${PREFIX}__item`}
|
||||
name={name}
|
||||
icon={
|
||||
<Image
|
||||
className={`${PREFIX}__icon`}
|
||||
mode="aspectFit"
|
||||
src={
|
||||
value.includes(name)
|
||||
? require('@/statics/svg/radio-checked.svg')
|
||||
: require('@/statics/svg/radio-uncheck.svg')
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{text}
|
||||
</Checkbox>
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user