Skip to content

Commit 2057b22

Browse files
committed
WIP
1 parent b2eec6b commit 2057b22

File tree

343 files changed

+8188
-7761
lines changed

Some content is hidden

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

343 files changed

+8188
-7761
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/CatalogueInfoCard/index.tsx

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { useCallback } from 'react';
22
import {
33
Container,
4-
List,
4+
ListView,
5+
RawList,
56
} from '@ifrc-go/ui';
6-
import { _cs } from '@togglecorp/fujs';
77

88
import Link, { type Props as LinkProps } from '#components/Link';
99

10-
import styles from './styles.module.css';
11-
1210
export type LinkData = LinkProps & {
1311
title: string;
1412
}
@@ -19,7 +17,6 @@ interface Props {
1917
title: string;
2018
data: LinkData[];
2119
description?: string;
22-
descriptionClassName?: string;
2320
}
2421

2522
function CatalogueInfoCard(props: Props) {
@@ -28,7 +25,6 @@ function CatalogueInfoCard(props: Props) {
2825
title,
2926
data,
3027
description,
31-
descriptionClassName,
3228
} = props;
3329

3430
const rendererParams = useCallback(
@@ -56,26 +52,27 @@ function CatalogueInfoCard(props: Props) {
5652

5753
return (
5854
<Container
59-
className={_cs(styles.catalogueInfoCard, className)}
55+
className={className}
6056
heading={title}
6157
headingLevel={4}
6258
withHeaderBorder
63-
withInternalPadding
64-
headerDescriptionContainerClassName={descriptionClassName}
6559
headerDescription={description}
66-
spacing="comfortable"
60+
withPadding
61+
withBackground
62+
withShadow
6763
>
68-
<List
69-
className={styles.list}
70-
data={data}
71-
keySelector={catalogueInfoKeySelector}
72-
renderer={Link}
73-
errored={false}
74-
pending={false}
75-
filtered={false}
76-
rendererParams={rendererParams}
77-
compact
78-
/>
64+
<ListView
65+
layout="block"
66+
spacing="sm"
67+
withSpacingOpticalCorrection
68+
>
69+
<RawList
70+
data={data}
71+
keySelector={catalogueInfoKeySelector}
72+
renderer={Link}
73+
rendererParams={rendererParams}
74+
/>
75+
</ListView>
7976
</Container>
8077
);
8178
}

app/src/components/CatalogueInfoCard/styles.module.css

Lines changed: 0 additions & 10 deletions
This file was deleted.

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
);

0 commit comments

Comments
 (0)