feat: first commit

This commit is contained in:
eleanor.mao
2025-03-31 22:34:22 +08:00
commit d25187c9c8
390 changed files with 57031 additions and 0 deletions

View File

@ -0,0 +1,58 @@
import { Button } from '@tarojs/components';
import { Popup } from '@taroify/core';
import { useCallback, useEffect, useState } from 'react';
import SafeBottomPadding from '@/components/safe-bottom-padding';
import Select from '@/components/select';
import { MaterialStatus } from '@/constants/material';
import { MaterialProfile } from '@/types/material';
import './index.less';
interface IProps {
open: boolean;
value: MaterialStatus;
onSave: (newValue: MaterialProfile['isOpen']) => void;
onClose: () => void;
}
const PREFIX = 'material-manage-popup';
const OPTIONS = [
{ label: '开放', value: MaterialStatus.Open },
{ label: '关闭', value: MaterialStatus.Close },
];
function MaterialManagePopup(props: IProps) {
const { open, value = MaterialStatus.Open, onSave, onClose } = props;
const [currentValue, setCurrentValue] = useState<MaterialStatus>(value);
const handleSelect = useCallback((v: MaterialStatus) => setCurrentValue(v), []);
const handleSave = useCallback(() => {
onSave(currentValue === MaterialStatus.Open);
onClose();
}, [currentValue, onSave, onClose]);
useEffect(() => {
setCurrentValue(value);
}, [value]);
return (
<Popup className={`${PREFIX}__popup`} placement="bottom" open={open} onClose={onClose}>
<div className={PREFIX}>
<div className={`${PREFIX}__header`}>
<div className={`${PREFIX}__title`}></div>
<div className={`${PREFIX}__tips`}></div>
</div>
<Select className={`${PREFIX}__select`} options={OPTIONS} value={currentValue} onSelect={handleSelect} />
<Button className={`${PREFIX}__btn`} onClick={handleSave}>
</Button>
</div>
<SafeBottomPadding />
</Popup>
);
}
export default MaterialManagePopup;