Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 发布弹框左右两侧显示隐藏过渡动画完成
gaoSir8734ff2d8252
diff --git a/.idea/workspace.xml b/.idea/workspace.xmlindex 3a3c3bfc..6964eb04 100644--- a/.idea/workspace.xml+++ b/.idea/workspace.xml@@ -4,18 +4,12 @@<option name="autoReloadType" value="SELECTIVE" /></component><component name="ChangeListManager">- <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="fix: 日历调整">- <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" afterDir="false" />- <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/usePublishDialog.ts" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" afterDir="false" />+ <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="feat: 发布大改">+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PublishDialogAi.tsx" afterDir="false" />+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PublishDialogPreview.tsx" afterDir="false" /><change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/CalendarTimingItem.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/calendarTimingItem.module.scss" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/index.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/[lng]/layout.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/layout.tsx" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/app/layout/LyaoutFooter.tsx" beforeDir="false" />+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.module.scss" afterDir="false" /></list><option name="SHOW_DIALOG" value="false" /><option name="HIGHLIGHT_CONFLICTS" value="true" />@@ -118,7 +112,15 @@<option name="project" value="LOCAL" /><updated>1750683522810</updated></task>- <option name="localTasksCounter" value="4" />+ <task id="LOCAL-00004" summary="feat: 发布大改">+ <option name="closed" value="true" />+ <created>1750754877260</created>+ <option name="number" value="00004" />+ <option name="presentableId" value="LOCAL-00004" />+ <option name="project" value="LOCAL" />+ <updated>1750754877260</updated>+ </task>+ <option name="localTasksCounter" value="5" /><servers /></component><component name="TypeScriptGeneratedFilesManager">@@ -141,6 +143,7 @@<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /><MESSAGE value="feat: 日历完善" /><MESSAGE value="fix: 日历调整" />- <option name="LAST_COMMIT_MESSAGE" value="" />+ <MESSAGE value="feat: 发布大改" />+ <option name="LAST_COMMIT_MESSAGE" value="feat: 发布大改" /></component></project>\ No newline at end of filediff --git a/src/components/PublishDialog/compoents/PublishDialogAi.tsx b/src/components/PublishDialog/compoents/PublishDialogAi.tsxnew file mode 100644index 00000000..9fb7f137--- /dev/null+++ b/src/components/PublishDialog/compoents/PublishDialogAi.tsx@@ -0,0 +1,20 @@+import { ForwardedRef, forwardRef, memo } from "react";+import styles from "../publishDialog.module.scss";++export interface IPublishDialogAiRef {}++export interface IPublishDialogAiProps {}++const PublishDialogAi = memo(+ forwardRef(+ ({}: IPublishDialogAiProps, ref: ForwardedRef<IPublishDialogAiRef>) => {+ return (+ <div className={styles.publishDialogAi}>+ <div className="publishDialogAi-wrapper">AI写作</div>+ </div>+ );+ },+ ),+);++export default PublishDialogAi;diff --git a/src/components/PublishDialog/compoents/PublishDialogPreview.tsx b/src/components/PublishDialog/compoents/PublishDialogPreview.tsxnew file mode 100644index 00000000..aa2a8805--- /dev/null+++ b/src/components/PublishDialog/compoents/PublishDialogPreview.tsx@@ -0,0 +1,23 @@+import { ForwardedRef, forwardRef, memo } from "react";+import styles from "../publishDialog.module.scss";++export interface IPublishDialogPreviewRef {}++export interface IPublishDialogPreviewProps {}++const PublishDialogPreview = memo(+ forwardRef(+ (+ {}: IPublishDialogPreviewProps,+ ref: ForwardedRef<IPublishDialogPreviewRef>,+ ) => {+ return (+ <div className={styles.publishDialogPreview}>+ <div className="publishDialogPreview-wrapper">预览</div>+ </div>+ );+ },+ ),+);++export default PublishDialogPreview;diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsxindex 53112cce..e1f97843 100644--- a/src/components/PublishDialog/index.tsx+++ b/src/components/PublishDialog/index.tsx@@ -1,7 +1,10 @@-import { ForwardedRef, forwardRef, memo, useCallback } from "react";+import { ForwardedRef, forwardRef, memo, useCallback, useState } from "react";import styles from "./publishDialog.module.scss";import { Button, Modal } from "antd";import { ExclamationCircleFilled } from "@ant-design/icons";+import PublishDialogAi from "@/components/PublishDialog/compoents/PublishDialogAi";+import PublishDialogPreview from "@/components/PublishDialog/compoents/PublishDialogPreview";+import { CSSTransition } from "react-transition-group";export interface IPublishDialogRef {}@@ -19,12 +22,16 @@ const PublishDialog = memo({ open, onClose }: IPublishDialogProps,ref: ForwardedRef<IPublishDialogRef>,) => {+ const [openLeft, setOpenLeft] = useState(false);+ const [openRight, setOpenRight] = useState(false);+ const [showB, setShowB] = useState(true);+// 关闭弹框并确认关闭const closeDialog = useCallback(() => {confirm({title: "放弃更改?",icon: <ExclamationCircleFilled />,- content: "您所做的任何更改都将永久丢失 ",+ content: "您所做的任何更改都将永久丢失",okType: "danger",okButtonProps: {type: "primary",@@ -44,13 +51,23 @@ const PublishDialog = memo(<ModalclassName={styles.publishDialog}closeIcon={false}- width={710}open={open}onCancel={closeDialog}- footer={- <div className={styles.publishDialogFooter}>+ footer={null}+ >+ <CSSTransition+ in={openLeft}+ timeout={300}+ classNames="left"+ unmountOnExit+ >+ <PublishDialogAi />+ </CSSTransition>++ <div className="publishDialog-con">+ <div className="publishDialogFooter-footer">time- <div className="publishDialogFooter-btns">+ <div className="publishDialogFooter-footer-btns"><Button size="large" onClick={closeDialog}>取消</Button>@@ -59,9 +76,16 @@ const PublishDialog = memo(</Button></div></div>- }- >- <div className="publishDialog-con"></div>+ </div>++ <CSSTransition+ in={openRight}+ timeout={300}+ classNames="right"+ unmountOnExit+ >+ <PublishDialogPreview />+ </CSSTransition></Modal></>);diff --git a/src/components/PublishDialog/publishDialog.module.scss b/src/components/PublishDialog/publishDialog.module.scssindex 4a7cf447..b502e882 100644--- a/src/components/PublishDialog/publishDialog.module.scss+++ b/src/components/PublishDialog/publishDialog.module.scss@@ -1,25 +1,76 @@+$assistantWidth: 250px;+.publishDialog {+ width: auto !important;:global {.ant-modal-content {padding: 0 !important;}.publishDialog-con {- padding: 20px;+ background: #fff;+ min-height: 500px;+ position: relative;+ z-index: 10;+ border-radius: 8px;+ width: 700px;+ .publishDialogFooter-footer {+ display: flex;+ align-items: center;+ //border-top: 1px solid var(--grayColor4);+ justify-content: space-between;+ &-btns {+ button {+ margin-right: 10px;+ }+ }+ }+ }+ .ant-modal-body {+ display: flex;+ justify-content: center;+ }+ .ant-modal-content {+ background-color: transparent !important;+ box-shadow: none !important;+ }++ .right-enter, .left-enter {+ width: 0;+ }+ .right-enter-active, .left-enter-active {+ width: $assistantWidth;+ transition: all 300ms;+ }+ .right-exit, .left-exit {+ width: $assistantWidth;+ }+ .right-exit-active, .left-exit-active {+ width: 0;+ transition: all 300ms;}}}-.publishDialogFooter {- display: flex;- align-items: center;- border-top: 1px solid var(--grayColor4);- padding: 20px;- justify-content: space-between;+.publishDialogAi, .publishDialogPreview {+ background: #fff;+ width: $assistantWidth;+ overflow: hidden;+ border-radius: 8px;+}++.publishDialogAi {+ margin-right: 15px;:global {- .publishDialogFooter-btns {- button {- margin-right: 10px;- }+ .publishDialogAi-wrapper {+ min-width: $assistantWidth;}}-}\ No newline at end of file+}+.publishDialogPreview {+ margin-left: 15px;+ :global {+ .publishDialogPreview-wrapper {+ min-width: $assistantWidth;+ }+ }+}