Skip to content

Commit 11f0186

Browse files
committed
Improve styling of mobile preview
1 parent 6367424 commit 11f0186

File tree

12 files changed

+114
-44
lines changed

12 files changed

+114
-44
lines changed

manager-dashboard/app/Base/styles.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ p {
9999
--width-navbar-content-max: 76rem;
100100

101101
--width-mobile-preview: 22rem;
102-
--height-mobile-preview: 30rem;
102+
--height-mobile-preview: 40rem;
103+
--height-mobile-preview-builarea-content: 30rem;
104+
--height-mobile-preview-footprint-content: 22rem;
105+
--height-mobile-preview-change-detection-content: 14rem;
103106

104107
--radius-popup-border: 0.25rem;
105108
--radius-scrollbar-border: 0.25rem;

manager-dashboard/app/components/GeoJsonPreview/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function GeoJsonPreview(props: Props) {
6565
if (mapContainerRef.current && !mapRef.current) {
6666
mapRef.current = createMap(mapContainerRef.current, {
6767
zoomSnap: 0,
68+
scrollWheelZoom: false,
6869
});
6970
}
7071

manager-dashboard/app/components/MobilePreview/index.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { IoArrowBack } from 'react-icons/io5';
2+
import { IoArrowBack, IoInformationCircleOutline } from 'react-icons/io5';
33
import { _cs } from '@togglecorp/fujs';
44

55
import Heading from '#components/Heading';
@@ -15,6 +15,7 @@ interface Props {
1515
popupDescription?: React.ReactNode;
1616
popupIcons?: React.ReactNode;
1717
contentClassName?: string;
18+
popupClassName?: string;
1819
}
1920

2021
function MobilePreview(props: Props) {
@@ -27,6 +28,7 @@ function MobilePreview(props: Props) {
2728
popupDescription,
2829
popupIcons,
2930
contentClassName,
31+
popupClassName,
3032
} = props;
3133

3234
return (
@@ -37,19 +39,23 @@ function MobilePreview(props: Props) {
3739
</div>
3840
<Heading
3941
className={styles.heading}
40-
level={4}
42+
level={5}
4143
>
42-
{heading}
43-
</Heading>
44-
{actions && (
45-
<div className={styles.actions}>
46-
{actions}
44+
<div className={styles.label}>
45+
You are looking for:
4746
</div>
48-
)}
47+
<div>
48+
{heading}
49+
</div>
50+
</Heading>
51+
<div className={styles.actions}>
52+
{actions}
53+
<IoInformationCircleOutline className={styles.infoIcon} />
54+
</div>
4955
</div>
50-
<div className={_cs(styles.content, contentClassName)}>
56+
<div className={styles.contentContainer}>
5157
{(popupTitle || popupDescription || popupIcons) && (
52-
<div className={styles.popup}>
58+
<div className={_cs(styles.popup, popupClassName)}>
5359
<div className={styles.details}>
5460
<div>
5561
{popupTitle}
@@ -63,7 +69,9 @@ function MobilePreview(props: Props) {
6369
</div>
6470
</div>
6571
)}
66-
{children}
72+
<div className={_cs(styles.content, contentClassName)}>
73+
{children}
74+
</div>
6775
</div>
6876
</div>
6977
);

manager-dashboard/app/components/MobilePreview/styles.css

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,56 @@
66
background-color: var(--color-black);
77
padding: var(--spacing-small) 0;
88
width: var(--width-mobile-preview);
9+
height: var(--height-mobile-preview);
910
color: var(--color-text-on-dark);
1011

1112
.header {
1213
display: flex;
14+
flex-shrink: 0;
1315
background-color: var(--color-primary);
1416
padding: var(--spacing-medium);
1517
gap: var(--spacing-medium);
1618

19+
.heading {
20+
display: flex;
21+
flex-direction: column;
22+
flex-grow: 1;
23+
text-align: center;
24+
25+
.label {
26+
font-weight: var(--font-weight-medium);
27+
}
28+
}
29+
1730
.icons {
1831
.back-icon {
19-
font-size: 1.2rem;
32+
font-size: 2rem;
2033
}
34+
}
2135

22-
.heading {
23-
flex-grow: 1;
24-
}
36+
.actions {
37+
flex-shrink: 0;
2538

26-
.actions {
27-
flex-shrink: 0;
39+
.info-icon {
40+
font-size: 1.6rem;
2841
}
2942
}
3043
}
3144

32-
.content {
45+
.content-container {
46+
display: flex;
3347
position: relative;
48+
flex-direction: column;
3449
flex-grow: 1;
3550
z-index: 0;
3651
background-color: var(--color-primary);
52+
padding: 1rem;
53+
overflow: auto;
54+
55+
.content {
56+
flex-grow: 1;
57+
overflow: auto;
58+
}
3759

3860
.popup {
3961
display: flex;

manager-dashboard/app/views/NewTutorial/InformationPageInput/InformationPagePreview/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function InformationPagePreview(props: Props) {
2222
<MobilePreview
2323
className={styles.informationPreview}
2424
// FIXME: get this from 'look for'
25-
heading="You are looking for: mobile homes"
25+
heading="mobile homes"
2626
contentClassName={styles.content}
2727
>
2828
{value?.title || `Intro ${index + 1}`}

manager-dashboard/app/views/NewTutorial/ScenarioPageInput/ChangeDetectionGeoJsonPreview/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default function ChangeDetectionGeoJsonPreview(props: Props) {
3838
popupTitle={previewPopUp?.title ?? 'Title'}
3939
popupDescription={previewPopUp?.description ?? 'Description'}
4040
contentClassName={styles.content}
41+
popupClassName={styles.popup}
4142
>
4243
<GeoJsonPreview
4344
className={styles.mapPreview}

manager-dashboard/app/views/NewTutorial/ScenarioPageInput/ChangeDetectionGeoJsonPreview/styles.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
.content {
33
display: flex;
44
flex-direction: column;
5-
padding: var(--spacing-medium);
5+
justify-content: space-between;
66
gap: var(--spacing-extra-large);
77

88
.map-preview {
9-
height: 16rem;
9+
align-self: center;
10+
width: var(--height-mobile-preview-change-detection-content);
11+
height: var(--height-mobile-preview-change-detection-content);
1012
}
1113
}
14+
15+
.popup {
16+
top: 50%!important;
17+
transform: translateY(-50%);
18+
}
1219
}

manager-dashboard/app/views/NewTutorial/ScenarioPageInput/FootprintGeoJsonPreview/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default function FootprintGeoJsonPreview(props: Props) {
3737
popupIcons={Comp && <Comp />}
3838
popupTitle={previewPopUp?.title ?? 'Title'}
3939
popupDescription={previewPopUp?.description ?? 'Description'}
40+
contentClassName={styles.content}
4041
>
4142
<GeoJsonPreview
4243
className={styles.mapPreview}
@@ -49,10 +50,14 @@ export default function FootprintGeoJsonPreview(props: Props) {
4950
return (
5051
<div
5152
key={option.id}
52-
className={styles.option}
53-
style={{ backgroundColor: option.iconColor }}
53+
className={styles.optionContainer}
5454
>
55-
<Icon />
55+
<div
56+
className={styles.option}
57+
style={{ backgroundColor: option.iconColor }}
58+
>
59+
<Icon />
60+
</div>
5661
</div>
5762
);
5863
})}
Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
.footprint-geo-json-preview {
2-
.map-preview {
3-
position: relative;
4-
z-index: 0;
5-
height: var(--height-mobile-preview);
6-
}
7-
8-
.options {
2+
.content {
93
display: flex;
10-
justify-content: center;
11-
padding: var(--spacing-large);
4+
flex-direction: column;
125
gap: var(--spacing-large);
136

14-
.option {
15-
display: flex;
16-
align-items: center;
17-
border-radius: 50%;
18-
padding: var(--spacing-small);
19-
font-size: var(--font-size-extra-large);
7+
.map-preview {
8+
position: relative;
9+
z-index: 0;
10+
height: var(--height-mobile-preview-footprint-content);
11+
}
12+
13+
.options {
14+
display: grid;
15+
flex-grow: 1;
16+
grid-template-columns: 1fr 1fr 1fr;
17+
grid-gap: var(--spacing-large);
18+
19+
.option-container {
20+
display: flex;
21+
align-items: center;
22+
justify-content: center;
23+
24+
.option {
25+
display: flex;
26+
align-items: center;
27+
justify-content: center;
28+
border-radius: 50%;
29+
width: 2.5rem;
30+
height: 2.5rem;
31+
font-size: var(--font-size-extra-large);
32+
}
33+
}
2034
}
2135
}
2236
}

manager-dashboard/app/views/NewTutorial/ScenarioPageInput/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ interface Props {
7777
url: string | undefined;
7878
urlB: string | undefined;
7979
customOptionsPreview?: CustomOptionPreviewType[];
80+
scenarioId: number;
8081
}
8182

8283
export default function ScenarioPageInput(props: Props) {
@@ -85,11 +86,12 @@ export default function ScenarioPageInput(props: Props) {
8586
onChange,
8687
index,
8788
error: riskyError,
88-
geoJson,
89+
geoJson: geoJsonFromProps,
8990
url,
9091
projectType,
9192
urlB,
9293
customOptionsPreview,
94+
scenarioId,
9395
} = props;
9496

9597
const [activeSegmentInput, setActiveInput] = React.useState<ScenarioSegmentType['value']>('instruction');
@@ -105,6 +107,12 @@ export default function ScenarioPageInput(props: Props) {
105107
const instructionsError = getErrorObject(error?.instruction);
106108
const hintError = getErrorObject(error?.hint);
107109
const successError = getErrorObject(error?.success);
110+
const geoJson = {
111+
...geoJsonFromProps,
112+
features: geoJsonFromProps?.features.filter(
113+
(feature) => feature.properties.screen === scenarioId,
114+
),
115+
};
108116

109117
const handleScenarioType = React.useCallback((scenarioSegment: ScenarioSegmentType['value']) => {
110118
setActiveInput(scenarioSegment);

0 commit comments

Comments
 (0)