diff --git a/public/bg/Squares.png b/public/bg/Squares.png deleted file mode 100644 index 260d904ff..000000000 Binary files a/public/bg/Squares.png and /dev/null differ diff --git a/public/bg/Waihou.png b/public/wallpaper/bubbles.png similarity index 100% rename from public/bg/Waihou.png rename to public/wallpaper/bubbles.png diff --git a/public/bg/tg-cartoon.jpeg b/public/wallpaper/cartoon.jpeg similarity index 100% rename from public/bg/tg-cartoon.jpeg rename to public/wallpaper/cartoon.jpeg diff --git a/public/bg/tg-co2.jpeg b/public/wallpaper/co2.jpeg similarity index 100% rename from public/bg/tg-co2.jpeg rename to public/wallpaper/co2.jpeg diff --git a/public/bg/tg-code.jpg b/public/wallpaper/code.jpg similarity index 100% rename from public/bg/tg-code.jpg rename to public/wallpaper/code.jpg diff --git a/public/bg/Taieri.png b/public/wallpaper/curves.png similarity index 100% rename from public/bg/Taieri.png rename to public/wallpaper/curves.png diff --git a/public/bg/tg-earth.jpg b/public/wallpaper/earth.jpg similarity index 100% rename from public/bg/tg-earth.jpg rename to public/wallpaper/earth.jpg diff --git a/public/bg/tg-elec.jpg b/public/wallpaper/elec.jpg similarity index 100% rename from public/bg/tg-elec.jpg rename to public/wallpaper/elec.jpg diff --git a/public/bg/Fishes.jpeg b/public/wallpaper/fishes.jpeg similarity index 100% rename from public/bg/Fishes.jpeg rename to public/wallpaper/fishes.jpeg diff --git a/public/bg/tg-istanbul.jpeg b/public/wallpaper/istanbul.jpeg similarity index 100% rename from public/bg/tg-istanbul.jpeg rename to public/wallpaper/istanbul.jpeg diff --git a/public/bg/Limones.jpeg b/public/wallpaper/limones.jpeg similarity index 100% rename from public/bg/Limones.jpeg rename to public/wallpaper/limones.jpeg diff --git a/public/bg/Mataura.png b/public/wallpaper/mataura.png similarity index 100% rename from public/bg/Mataura.png rename to public/wallpaper/mataura.png diff --git a/public/bg/Antiquitarian.jpeg b/public/wallpaper/newspaper.jpeg similarity index 100% rename from public/bg/Antiquitarian.jpeg rename to public/wallpaper/newspaper.jpeg diff --git a/public/wallpaper/patterns/1.png b/public/wallpaper/patterns/1.png new file mode 100644 index 000000000..38895e677 Binary files /dev/null and b/public/wallpaper/patterns/1.png differ diff --git a/public/bg/CyBeRGaTa.jpeg b/public/wallpaper/rainbow.jpeg similarity index 100% rename from public/bg/CyBeRGaTa.jpeg rename to public/wallpaper/rainbow.jpeg diff --git a/public/bg/space.svg b/public/wallpaper/space.svg similarity index 100% rename from public/bg/space.svg rename to public/wallpaper/space.svg diff --git a/public/bg/tg-green.jpg b/public/wallpaper/tg-green.jpg similarity index 100% rename from public/bg/tg-green.jpg rename to public/wallpaper/tg-green.jpg diff --git a/src/containers/editor/WallpaperEditor/BuildIn/AnglePanel.tsx b/src/containers/editor/WallpaperEditor/BuildIn/AnglePanel.tsx new file mode 100644 index 000000000..a9ffe99e5 --- /dev/null +++ b/src/containers/editor/WallpaperEditor/BuildIn/AnglePanel.tsx @@ -0,0 +1,48 @@ +import { FC, memo } from 'react' + +import { + Wrapper, + Top, + Bottom, + Left, + Right, + NeedleDot, + Needle, +} from '../styles/build_in/angle_panel' +import { changeDirection } from '../logic' + +type TProps = { + direction: string +} + +const AnglePanel: FC = ({ direction }) => { + return ( + + changeDirection('top')}> + 上 + + changeDirection('bottom')} + > + 下 + + changeDirection('left')} + > + 左 + + changeDirection('right')} + > + 右 + + + + + ) +} + +export default memo(AnglePanel) diff --git a/src/containers/editor/WallpaperEditor/BuildIn/GradientGroup.tsx b/src/containers/editor/WallpaperEditor/BuildIn/GradientGroup.tsx new file mode 100644 index 000000000..51a9d5e91 --- /dev/null +++ b/src/containers/editor/WallpaperEditor/BuildIn/GradientGroup.tsx @@ -0,0 +1,43 @@ +import { FC, memo } from 'react' +import { keys } from 'ramda' + +import type { TWallpaperGradient } from '@/spec' +import { parseWallpaper } from '@/utils/wallpaper' + +import { + Wrapper, + Block, + BallWrapper, + ColorBall, +} from '../styles/build_in/gradient_group' + +import { changeWallpaper } from '../logic' + +type TProps = { + wallpaper: string + gradientWallpapers: Record +} + +const PicGroup: FC = ({ wallpaper, gradientWallpapers }) => { + const gradientKeys = keys(gradientWallpapers) + + return ( + + {gradientKeys.map((name) => ( + + changeWallpaper(name)} + > + + + + ))} + + ) +} + +export default memo(PicGroup) diff --git a/src/containers/editor/WallpaperEditor/BuildIn/PatternGroup.tsx b/src/containers/editor/WallpaperEditor/BuildIn/PatternGroup.tsx new file mode 100644 index 000000000..9ba1f230e --- /dev/null +++ b/src/containers/editor/WallpaperEditor/BuildIn/PatternGroup.tsx @@ -0,0 +1,43 @@ +import { FC, memo } from 'react' +import { keys } from 'ramda' + +import type { TWallpaperPic } from '@/spec' + +import { + Wrapper, + Block, + Image, + ActiveSign, + CheckIcon, +} from '../styles/build_in/pattern_group' + +import { changeWallpaper } from '../logic' + +type TProps = { + wallpaper: string + patternWallpapers: Record +} + +const PatternGroup: FC = ({ wallpaper, patternWallpapers }) => { + const patternKeys = keys(patternWallpapers) + + return ( + + {patternKeys.map((name) => ( + + {name === wallpaper && ( + + + + )} + changeWallpaper(name)} + /> + + ))} + + ) +} + +export default memo(PatternGroup) diff --git a/src/containers/editor/WallpaperEditor/BuildIn/index.tsx b/src/containers/editor/WallpaperEditor/BuildIn/index.tsx new file mode 100644 index 000000000..03b16236e --- /dev/null +++ b/src/containers/editor/WallpaperEditor/BuildIn/index.tsx @@ -0,0 +1,91 @@ +/* * + * WallpaperEditor + * + */ + +import { FC, Fragment } from 'react' + +import { WALLPAPER_TYPE } from '@/constant' + +import { Br } from '@/widgets/Common' +import Checker from '@/widgets/Checker' + +import PatternGroup from './PatternGroup' +import GradientGroup from './GradientGroup' +import AnglePanel from './AnglePanel' + +import type { TWallpaperData } from '../spec' +import { + Wrapper, + Title, + SettingWrapper, + GeneralSettings, + Divider, + AngleSettings, +} from '../styles/build_in' +import { togglePattern, toggleBlur } from '../logic' + +type TProps = { + wallpaperData: TWallpaperData +} + +const BuildIn: FC = ({ wallpaperData }) => { + const { + wallpaper, + wallpaperType, + gradientWallpapers, + patternWallpapers, + hasPattern, + hasBlur, + direction, + } = wallpaperData + + return ( + + 图案: + +
+ 纯色渐变: + +
+ + + 附加效果: + {wallpaperType === WALLPAPER_TYPE.GRADIENT && ( + +
+ + 叠加印纹 + +
+ )} + +
+ + 模糊效果 + +
+ + {wallpaperType === WALLPAPER_TYPE.GRADIENT && ( + + + + + 渐变方向: + + + + )} +
+
+
+ ) +} + +export default BuildIn diff --git a/src/containers/editor/WallpaperEditor/Custom/UploadBox.tsx b/src/containers/editor/WallpaperEditor/Custom/UploadBox.tsx new file mode 100644 index 000000000..d79b4525a --- /dev/null +++ b/src/containers/editor/WallpaperEditor/Custom/UploadBox.tsx @@ -0,0 +1,36 @@ +import { FC, memo } from 'react' + +import { SVG } from '@/constant' +import MenuButton from '@/widgets/Buttons/MenuButton' + +import { + Wrapper, + Menu, + MoreIcon, + UploadIcon, + Title, +} from '../styles/custom/upload_box' + +const menuOptions = [ + { + key: 'url', + icon: SVG.COPY, + title: '图片地址', + }, +] + +const UploadBox: FC = () => { + return ( + + + + + + + + 上传 / 引入图片 + + ) +} + +export default memo(UploadBox) diff --git a/src/containers/editor/WallpaperEditor/Custom/index.tsx b/src/containers/editor/WallpaperEditor/Custom/index.tsx new file mode 100644 index 000000000..4392f7852 --- /dev/null +++ b/src/containers/editor/WallpaperEditor/Custom/index.tsx @@ -0,0 +1,14 @@ +import { FC, memo } from 'react' + +import UploadBox from './UploadBox' +import { Wrapper } from '../styles/custom' + +const Custom: FC = () => { + return ( + + + + ) +} + +export default memo(Custom) diff --git a/src/containers/editor/WallpaperEditor/Footer.tsx b/src/containers/editor/WallpaperEditor/Footer.tsx new file mode 100644 index 000000000..6bae0030d --- /dev/null +++ b/src/containers/editor/WallpaperEditor/Footer.tsx @@ -0,0 +1,31 @@ +import { FC, memo } from 'react' + +import { TWallpaperType } from '@/spec' +import { WALLPAPER_TYPE } from '@/constant' + +import Button from '@/widgets/Buttons/Button' +import { Wrapper, ForbidImgIcon, ConfirmBtn } from './styles/footer' +import { changeWallpaper } from './logic' + +type TProps = { + wallpaperType: TWallpaperType +} +const Footer: FC = ({ wallpaperType }) => { + return ( + + {wallpaperType !== WALLPAPER_TYPE.NONE ? ( + + ) : ( +
+ )} + + + 确定 + + + ) +} + +export default memo(Footer) diff --git a/src/containers/editor/WallpaperEditor/constant.ts b/src/containers/editor/WallpaperEditor/constant.ts new file mode 100644 index 000000000..6b5149838 --- /dev/null +++ b/src/containers/editor/WallpaperEditor/constant.ts @@ -0,0 +1,17 @@ +import type { TTab } from './spec' + +export const TAB = { + BUILDIN: 'buildin', + CUSTOM: 'custom', +} as Record, TTab> + +export const TAB_OPTIONS = [ + { + title: '内置壁纸', + raw: TAB.BUILDIN, + }, + { + title: '上传壁纸', + raw: TAB.CUSTOM, + }, +] diff --git a/src/containers/editor/WallpaperEditor/index.tsx b/src/containers/editor/WallpaperEditor/index.tsx new file mode 100644 index 000000000..d0a994866 --- /dev/null +++ b/src/containers/editor/WallpaperEditor/index.tsx @@ -0,0 +1,66 @@ +/* * + * WallpaperEditor + * + */ + +import { FC } from 'react' + +import { bond } from '@/utils/mobx' +import { VIEW, DRAWER_SCROLLER } from '@/constant' + +import { Tabs } from '@/widgets/Switcher' +import CustomScroller from '@/widgets/CustomScroller' + +import type { TStore } from './store' +import { TAB, TAB_OPTIONS } from './constant' + +import BuildIn from './BuildIn' +import Custom from './Custom' +import Footer from './Footer' + +import { Wrapper, Banner, Title, Content } from './styles' +import { useInit, changeTab } from './logic' + +type TProps = { + wallpaperEditor?: TStore + testid?: string +} + +const WallpaperEditorContainer: FC = ({ + wallpaperEditor: store, + testid = 'wallpaper-editor', +}) => { + useInit(store) + const { tab, wallpaperData } = store + + return ( + + + 壁纸设置 + + + + + + {tab === TAB.BUILDIN && } + {tab === TAB.CUSTOM && } + + +