Skip to content

Commit f6ee9b5

Browse files
Onboarding Survey UI
ref DEV-1331 ref DEV-1336
2 parents dad182a + e50d07c commit f6ee9b5

File tree

7 files changed

+1104
-1
lines changed

7 files changed

+1104
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.body {
2+
@apply min-h-screen;
3+
@apply shrink-0;
4+
@apply flex flex-col;
5+
@apply relative;
6+
}
7+
8+
.logo {
9+
@apply absolute;
10+
@apply h-12;
11+
}
12+
13+
.content {
14+
@apply self-center;
15+
@apply flex flex-col;
16+
@apply mt-[100px] mx-4 mb-4;
17+
}
18+
19+
.navigationDiv {
20+
@apply self-center;
21+
@apply flex flex-row justify-between items-center;
22+
@apply gap-2.5;
23+
}
24+
25+
.SurveyTitle {
26+
@apply whitespace-pre-line;
27+
@apply text-center;
28+
@apply mb-6;
29+
}
30+
31+
.SurveySubtitle {
32+
@apply whitespace-pre-line;
33+
@apply text-center;
34+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import cn from "classnames";
2+
import React, { useContext, useMemo } from "react";
3+
import { useTheme, Text } from "@fluentui/react";
4+
import { Context } from "@oursky/react-messageformat";
5+
import styles from "./OnboardingSurveyLayout.module.css";
6+
import authgearLogoURL from "./images/authgear_logo_color.svg";
7+
8+
interface LogoProps {}
9+
10+
const Logo: React.VFC<LogoProps> = (_props: LogoProps) => {
11+
const { renderToString } = useContext(Context);
12+
const theme = useTheme();
13+
const logoStyles = useMemo(() => {
14+
return {
15+
fill: theme.semanticColors.bodyText,
16+
};
17+
}, [theme]);
18+
return (
19+
<img
20+
style={logoStyles}
21+
className={styles.logo}
22+
alt={renderToString("system.name")}
23+
src={authgearLogoURL}
24+
/>
25+
);
26+
};
27+
28+
export interface SurveyTitleProps {
29+
children?: React.ReactNode;
30+
}
31+
32+
export function SurveyTitle(props: SurveyTitleProps): React.ReactElement {
33+
const theme = useTheme();
34+
const overrideStyles = useMemo(() => {
35+
return {
36+
root: {
37+
color: theme.semanticColors.bodyText,
38+
},
39+
};
40+
}, [theme]);
41+
return (
42+
<Text
43+
styles={overrideStyles}
44+
className={styles.SurveyTitle}
45+
variant="xxLarge"
46+
block={true}
47+
>
48+
{props.children}
49+
</Text>
50+
);
51+
}
52+
53+
export interface SurveySubtitleProps {
54+
children?: React.ReactNode;
55+
}
56+
57+
export function SurveySubtitle(props: SurveySubtitleProps): React.ReactElement {
58+
const theme = useTheme();
59+
const overrideStyles = useMemo(() => {
60+
return {
61+
root: {
62+
color: theme.semanticColors.bodySubtext,
63+
},
64+
};
65+
}, [theme]);
66+
return (
67+
<Text
68+
styles={overrideStyles}
69+
className={styles.SurveySubtitle}
70+
variant="large"
71+
block={true}
72+
>
73+
{props.children}
74+
</Text>
75+
);
76+
}
77+
78+
export interface SurveyLayoutProps {
79+
title: string;
80+
subtitle: string;
81+
nextButton: React.ReactNode;
82+
backButton?: React.ReactNode;
83+
children?: React.ReactNode;
84+
contentClassName?: string;
85+
}
86+
87+
export default function SurveyLayout(
88+
props: SurveyLayoutProps
89+
): React.ReactElement {
90+
const {
91+
title,
92+
subtitle,
93+
nextButton,
94+
backButton,
95+
children,
96+
contentClassName,
97+
} = props;
98+
const theme = useTheme();
99+
const overrideBodyStyles = useMemo(() => {
100+
return {
101+
backgroundColor: theme.semanticColors.bodyStandoutBackground,
102+
};
103+
}, [theme]);
104+
return (
105+
<div style={overrideBodyStyles} className={styles.body}>
106+
<Logo />
107+
<div className={cn(styles.content, contentClassName)}>
108+
<SurveyTitle>{title}</SurveyTitle>
109+
<SurveySubtitle>{subtitle}</SurveySubtitle>
110+
{children}
111+
<div className={styles.navigationDiv}>
112+
{backButton}
113+
{nextButton}
114+
</div>
115+
</div>
116+
</div>
117+
);
118+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
.SingleChoiceButtonGroupVariantCentered {
2+
@apply my-[72px];
3+
@apply flex flex-row flex-wrap items-center justify-center;
4+
@apply gap-4;
5+
}
6+
7+
.SingleChoiceButtonGroupVariantLabeled {
8+
@apply flex flex-row flex-wrap items-center;
9+
@apply gap-4;
10+
@apply w-full;
11+
}
12+
13+
.formBox {
14+
@apply mt-[48px] mb-[72px];
15+
@apply grid;
16+
@apply gap-8;
17+
}
18+
19+
.step1Content {
20+
@apply max-w-[600px];
21+
}
22+
23+
.step2Content {
24+
@apply max-w-[420px];
25+
}
26+
27+
.step3Content {
28+
@apply max-w-[420px];
29+
}
30+
31+
.step4Content {
32+
@apply max-w-[760px];
33+
}
34+
35+
.step4 {
36+
@apply mt-[48px] mb-[72px];
37+
}
38+
39+
.MultiChoiceButtonGroup {
40+
@apply grid;
41+
@apply gap-6 mobile:gap-3;
42+
@apply grid-cols-2 mobile:grid-cols-1;
43+
grid-auto-rows: 1fr;
44+
}
45+
46+
.CompoundChoiceButton {
47+
max-width: 368px;
48+
min-height: 118px;
49+
height: 100%;
50+
padding: 25px;
51+
}
52+
53+
.otherReasonInput {
54+
@apply mt-8;
55+
}

0 commit comments

Comments
 (0)