-
Notifications
You must be signed in to change notification settings - Fork 0
[CORE-232] Fix form preview page #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
05eb3a6
a0163c9
0573974
70403cb
0245a17
4fa6985
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| .header { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.75rem; | ||
| } | ||
|
|
||
| .topBar { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| margin-bottom: 2rem; | ||
| } | ||
|
|
||
| .saveStatus { | ||
| display: inline-flex; | ||
| align-items: center; | ||
| gap: 0.375rem; | ||
| color: var(--comment); | ||
| font-size: 0.9rem; | ||
| } | ||
|
|
||
| .spinningIcon { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 有 LoadingSpinner component 喔 |
||
| animation: spin 1s linear infinite; | ||
| } | ||
|
|
||
| @keyframes spin { | ||
| from { | ||
| transform: rotate(0deg); | ||
| } | ||
| to { | ||
| transform: rotate(360deg); | ||
| } | ||
| } | ||
|
|
||
| .title { | ||
| margin-bottom: 1.5rem; | ||
| text-align: center; | ||
| font-family: var(--form-header-font, inherit); | ||
| } | ||
|
|
||
| .description { | ||
| color: var(--color-caption); | ||
| font-size: 1rem; | ||
| margin-bottom: 1rem; | ||
| } | ||
|
|
||
| .sectionHeader { | ||
| font-size: 1.6rem; | ||
| margin: 0; | ||
| color: var(--color-heading); | ||
| text-align: left; | ||
| font-family: var(--form-header-font, inherit); | ||
| } | ||
|
|
||
| .sectionDescription { | ||
| color: var(--color-caption); | ||
| font-size: 1rem; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { Button } from "@/shared/components"; | ||
| import { AlertCircle, Check, ChevronLeft, LoaderCircle } from "lucide-react"; | ||
| import styles from "./FormHeader.module.css"; | ||
|
|
||
| interface FormHeaderProps { | ||
| title: string; | ||
| formDescription?: string | null; | ||
| currentStep: number; | ||
| currentSection?: { title?: string; description?: string } | null; | ||
| onBack?: () => void; | ||
| saveStatus?: "saving" | "error" | "saved"; | ||
| } | ||
|
|
||
| export const FormHeader = ({ title, formDescription, currentStep, currentSection, onBack, saveStatus }: FormHeaderProps) => { | ||
| return ( | ||
| <div className={styles.header}> | ||
| {(onBack || saveStatus) && ( | ||
| <div className={styles.topBar}> | ||
| {onBack && ( | ||
| <Button type="button" onClick={onBack} themeColor="var(--foreground)"> | ||
| <ChevronLeft size={16} /> | ||
| 返回表單列表 | ||
| </Button> | ||
| )} | ||
| {saveStatus && ( | ||
| <div className={styles.saveStatus} aria-live="polite"> | ||
| {saveStatus === "saving" ? ( | ||
| <> | ||
| <LoaderCircle size={16} className={styles.spinningIcon} /> | ||
| <span>儲存中</span> | ||
| </> | ||
| ) : saveStatus === "error" ? ( | ||
| <> | ||
| <AlertCircle size={16} /> | ||
| <span>有問題</span> | ||
| </> | ||
| ) : ( | ||
| <> | ||
| <Check size={16} /> | ||
| <span>已儲存</span> | ||
| </> | ||
| )} | ||
| </div> | ||
| )} | ||
| </div> | ||
| )} | ||
| <h1 className={styles.title}>{title}</h1> | ||
| {currentStep === 0 && formDescription && <div className={styles.description} dangerouslySetInnerHTML={{ __html: formDescription }} />} | ||
| <h2 className={styles.sectionHeader}>{currentSection?.title}</h2> | ||
| {currentSection?.description && <div className={styles.sectionDescription} dangerouslySetInnerHTML={{ __html: currentSection.description }} />} | ||
|
Comment on lines
+47
to
+50
|
||
| </div> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| .previewSection { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 4rem; | ||
| } | ||
|
|
||
| .previewBlock { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1rem; | ||
| } | ||
|
|
||
| .previewHeader { | ||
| display: flex; | ||
| justify-content: space-between; | ||
| align-items: center; | ||
| padding-bottom: 0.75rem; | ||
| } | ||
|
|
||
| .previewTitle { | ||
| font-size: 1.6rem; | ||
| font-weight: 520; | ||
| color: var(--color-heading); | ||
| margin: 0; | ||
| } | ||
|
|
||
| .previewList { | ||
| list-style: disc; | ||
| padding-left: 1.5rem; | ||
| margin: 0; | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.75rem; | ||
| } | ||
|
|
||
| .previewList li { | ||
| font-size: 1rem; | ||
| color: var(--color-body); | ||
| line-height: 1.5; | ||
| } | ||
|
|
||
| .previewList li strong { | ||
| color: var(--color-heading); | ||
| font-weight: 600; | ||
| margin-right: 0.5rem; | ||
| } | ||
|
|
||
| .previewSectionTitle { | ||
| margin: 0; | ||
| } | ||
|
|
||
| .previewAnswerLabel { | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| .previewAnswerEmpty { | ||
| color: var(--red); | ||
| } | ||
|
|
||
| .requiredAsterisk { | ||
| color: var(--red); | ||
| } | ||
|
|
||
| .caption { | ||
| color: var(--color-caption); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.