Skip to content

Commit b4e9749

Browse files
committed
WIP
1 parent b2eec6b commit b4e9749

File tree

213 files changed

+4876
-3947
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+4876
-3947
lines changed

app/src/App/PageError/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function PageError() {
5858
<Button
5959
name={undefined}
6060
onClick={toggleFullErrorVisibility}
61-
variant="tertiary"
61+
styleVariant="action"
6262
>
6363
{fullErrorVisible ? strings.errorPageHide : strings.errorPageShowError}
6464
</Button>

app/src/App/index.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ function Application() {
239239
);
240240

241241
return (
242-
<RouteContext.Provider value={wrappedRoutes}>
243-
<UserContext.Provider value={userContextValue}>
244-
<AlertContext.Provider value={alertContextValue}>
245-
<RequestContext.Provider value={requestContextValue}>
246-
<LanguageContext.Provider value={languageContextValue}>
242+
<LanguageContext.Provider value={languageContextValue}>
243+
<RouteContext.Provider value={wrappedRoutes}>
244+
<UserContext.Provider value={userContextValue}>
245+
<AlertContext.Provider value={alertContextValue}>
246+
<RequestContext.Provider value={requestContextValue}>
247247
<RouterProvider
248248
router={router}
249249
fallbackElement={(
@@ -257,11 +257,11 @@ function Application() {
257257
</div>
258258
)}
259259
/>
260-
</LanguageContext.Provider>
261-
</RequestContext.Provider>
262-
</AlertContext.Provider>
263-
</UserContext.Provider>
264-
</RouteContext.Provider>
260+
</RequestContext.Provider>
261+
</AlertContext.Provider>
262+
</UserContext.Provider>
263+
</RouteContext.Provider>
264+
</LanguageContext.Provider>
265265
);
266266
}
267267

app/src/components/DropdownMenuItem/index.tsx

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,24 @@ type ButtonTypeProps<NAME> = Omit<ButtonProps<NAME>, 'type'> & {
2323

2424
type LinkTypeProps = LinkProps & {
2525
type: 'link';
26+
onClick?: never;
2627
}
2728

2829
type ConfirmButtonTypeProps<NAME> = Omit<ConfirmButtonProps<NAME>, 'type'> & {
2930
type: 'confirm-button',
3031
}
3132

32-
type Props<N> = CommonProp & (ButtonTypeProps<N> | LinkTypeProps | ConfirmButtonTypeProps<N>);
33+
type Props<NAME> = CommonProp & (
34+
ButtonTypeProps<NAME> | LinkTypeProps | ConfirmButtonTypeProps<NAME>
35+
);
3336

3437
function DropdownMenuItem<NAME>(props: Props<NAME>) {
3538
const {
36-
type,
37-
onClick,
3839
persist = false,
40+
onClick,
41+
...remainingProps
3942
} = props;
43+
4044
const { setShowDropdown } = useContext(DropdownMenuContext);
4145

4246
const handleLinkClick = useCallback(
@@ -51,71 +55,80 @@ function DropdownMenuItem<NAME>(props: Props<NAME>) {
5155

5256
const handleButtonClick = useCallback(
5357
(name: NAME, e: React.MouseEvent<HTMLButtonElement>) => {
54-
if (!persist) {
55-
setShowDropdown(false);
56-
}
57-
if (isDefined(onClick) && type !== 'link') {
58-
onClick(name, e);
58+
if (remainingProps.type !== 'link') {
59+
if (!persist) {
60+
setShowDropdown(false);
61+
}
62+
63+
if (isDefined(onClick)) {
64+
onClick(name, e);
65+
}
5966
}
6067
},
61-
[setShowDropdown, type, onClick, persist],
68+
[setShowDropdown, persist, onClick, remainingProps.type],
6269
);
6370

64-
if (type === 'link') {
71+
if (remainingProps.type === 'link') {
6572
const {
6673
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6774
type: _,
68-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
69-
persist: __,
70-
variant = 'dropdown-item',
75+
styleVariant = 'transparent',
76+
colorVariant = 'text',
77+
children,
7178
...otherProps
72-
} = props;
79+
} = remainingProps;
7380

7481
return (
7582
<Link
7683
// eslint-disable-next-line react/jsx-props-no-spreading
7784
{...otherProps}
78-
variant={variant}
85+
styleVariant={styleVariant}
86+
colorVariant={colorVariant}
7987
onClick={handleLinkClick}
80-
/>
88+
withFullWidth
89+
>
90+
{children}
91+
</Link>
8192
);
8293
}
8394

84-
if (type === 'button') {
95+
if (remainingProps.type === 'button') {
8596
const {
8697
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8798
type: _,
88-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
89-
persist: __,
90-
variant = 'dropdown-item',
99+
styleVariant = 'transparent',
100+
colorVariant = 'text',
91101
...otherProps
92-
} = props;
102+
} = remainingProps;
93103

94104
return (
95105
<Button
96106
// eslint-disable-next-line react/jsx-props-no-spreading
97107
{...otherProps}
98-
variant={variant}
108+
styleVariant={styleVariant}
109+
colorVariant={colorVariant}
99110
onClick={handleButtonClick}
111+
withFullWidth
100112
/>
101113
);
102114
}
103115

104-
if (type === 'confirm-button') {
116+
if (remainingProps.type === 'confirm-button') {
105117
const {
106118
// eslint-disable-next-line @typescript-eslint/no-unused-vars
107119
type: _,
108-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
109-
persist: __,
110-
variant = 'dropdown-item',
120+
styleVariant = 'transparent',
121+
colorVariant = 'text',
111122
...otherProps
112-
} = props;
123+
} = remainingProps;
113124

114125
return (
115126
<ConfirmButton
116127
// eslint-disable-next-line react/jsx-props-no-spreading
117128
{...otherProps}
118-
variant={variant}
129+
styleVariant={styleVariant}
130+
colorVariant={colorVariant}
131+
withFullWidth
119132
onClick={handleButtonClick}
120133
/>
121134
);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"namespace": "common",
3+
"strings": {
4+
"infoLabel": "Sources: ICRC, UN CODs",
5+
"mapDisclaimer":"The maps used do not imply the expression of any opinion on the part of the International Federation of Red Cross and Red Crescent Societies or National Society concerning the legal status of a territory or of its authorities.",
6+
"copyrightMapbox":"© Mapbox",
7+
"copyrightOSM":"© OpenStreetMap",
8+
"downloadButtonTitle":"Download",
9+
"failureToDownloadMessage":"Failed to download map. Try again.",
10+
"improveMapLabel": "Improve this map",
11+
"mapSourcesLabel": "Sources: ICRC, {uncodsLink}",
12+
"mapSourceUNCODsLabel": "UNCODs",
13+
"feedbackAriaLabel" : "Map feedback",
14+
"mapContainerMapbox": "Mapbox",
15+
"downloadHeaderLogoAltText":"IFRC GO logo",
16+
"mapContainerOpenStreetMap": "OpenStreetMap",
17+
"closeButtonLabel": "Close",
18+
"presentationModeButtonLabel": "Presentation Mode"
19+
}
20+
}

0 commit comments

Comments
 (0)