Skip to content

Commit 1854e11

Browse files
authored
Merge pull request #95 from kleros/chore/improve-component-library-integration
chore: properly integrate Kleros UI Component Library
2 parents 5dd185c + 3ab4948 commit 1854e11

File tree

42 files changed

+110
-143
lines changed

Some content is hidden

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

42 files changed

+110
-143
lines changed

web/src/components/ActionButton/ExecuteButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const ExecuteButton: React.FC<IExecuteButton> = ({ registryAddress, itemId, refe
2828
text="Execute"
2929
isDisabled={isLoading || isError || isExecuting || isPreparingConfig || disabled}
3030
isLoading={isLoading || isExecuting}
31-
onClick={() => {
31+
onPress={() => {
3232
if (!executeRequest || !config || !publicClient) return;
3333
setIsExecuting(true);
3434
wrapWithToast(async () => await executeRequest(config.request), publicClient)

web/src/components/ActionButton/Modal/Buttons/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ const Buttons: React.FC<IButtons> = ({
2424
}) => {
2525
return (
2626
<div className="flex flex-wrap gap-4 justify-between w-full">
27-
<Button variant="secondary" text="Return" onClick={toggleModal} />
27+
<Button variant="secondary" text="Return" onPress={toggleModal} />
2828
<EnsureChain>
2929
<EnsureAuth>
3030
<div className="flex flex-col items-center">
3131
<Button
3232
text={buttonText}
33-
onClick={() => {
33+
onPress={() => {
3434
callback();
3535
}}
3636
isLoading={isLoading}

web/src/components/ActionButton/Modal/Info.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ interface IInfo {
66
}
77

88
const Info: React.FC<IInfo> = ({ alertMessage }) => {
9-
return (
10-
<div className="flex w-full">
11-
<AlertMessage variant="info" title="Important" msg={alertMessage} />
12-
</div>
13-
);
9+
return <AlertMessage className="w-full" variant="info" title="Important" msg={alertMessage} />;
1410
};
1511

1612
export default Info;

web/src/components/ActionButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const ActionButton: React.FC<IActionButton> = ({ status, registryAddress, itemId
6464
variant="secondary"
6565
isDisabled={disabled}
6666
text={getModalButtonText(status ?? 0, isItem)}
67-
onClick={toggleModal}
67+
onPress={toggleModal}
6868
/>
6969
);
7070
}, [isExecutable, registryAddress, status, itemId, isLoading, disputeId, isItem, toggleModal, refetch]);

web/src/components/ConnectWallet/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const SwitchChainButton: React.FC = () => {
2424
isLoading={isLoading}
2525
isDisabled={isLoading}
2626
text={`Switch to ${SUPPORTED_CHAINS[DEFAULT_CHAIN].name}`}
27-
onClick={handleSwitch}
27+
onPress={handleSwitch}
2828
/>
2929
);
3030
};
@@ -38,7 +38,7 @@ const ConnectButton: React.FC<{ className?: string }> = ({ className }) => {
3838
isDisabled={isOpen}
3939
small
4040
text={"Connect"}
41-
onClick={async () => open({ view: "Connect" })}
41+
onPress={async () => open({ view: "Connect" })}
4242
/>
4343
);
4444
};

web/src/components/EnsureAuth.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const EnsureAuth: React.FC<IEnsureAuth> = ({ children, className }) => {
2929
) : (
3030
<Button
3131
text="Sign In"
32-
onClick={handleClick}
32+
onPress={handleClick}
3333
isDisabled={isSigningIn || !address}
3434
isLoading={isSigningIn}
3535
{...{ className }}

web/src/components/HistoryDisplay/Party/JustificationModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const JustificationModal: React.FC<IJustificationModal> = ({ request, toggleModa
4848
<label className="w-full">No Justification provided</label>
4949
)}
5050
<div className="flex flex-wrap justify-between w-full mt-9 gap-y-2">
51-
<Button variant="secondary" text="Return" onClick={toggleModal} />
51+
<Button variant="secondary" text="Return" onPress={toggleModal} />
5252
{!request.resolved && (
5353
<ActionButton
5454
isItem

web/src/components/LightButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { cn } from "src/utils";
55
interface ILightButton {
66
text: string;
77
Icon?: React.FC<React.SVGAttributes<SVGElement>>;
8-
onClick?: React.MouseEventHandler<HTMLButtonElement>;
8+
onPress?: () => void;
99
disabled?: boolean;
1010
className?: string;
1111
isMobileNavbar?: boolean;
1212
}
1313

14-
const LightButton: React.FC<ILightButton> = ({ text, Icon, onClick, disabled, className, isMobileNavbar }) => (
14+
const LightButton: React.FC<ILightButton> = ({ text, Icon, onPress, disabled, className, isMobileNavbar }) => (
1515
<Button
1616
variant="primary"
1717
small
@@ -25,7 +25,7 @@ const LightButton: React.FC<ILightButton> = ({ text, Icon, onClick, disabled, cl
2525
: "[&_.button-svg]:fill-white/75 hover:[&_.button-svg]:fill-white",
2626
className
2727
)}
28-
{...{ text, Icon, onClick, disabled }}
28+
{...{ text, Icon, disabled, onPress }}
2929
/>
3030
);
3131

web/src/components/Search.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Search: React.FC<{ isList?: Boolean }> = ({ isList }) => {
1414
const keywords = searchParams.get("keywords");
1515

1616
const decodedFilter = decodeListURIFilter(filter ?? "all");
17-
const [search, setSearch] = useState(keywords ?? undefined);
17+
const [search, setSearch] = useState(keywords ?? "");
1818
const navigate = useNavigate();
1919

2020
useDebounce(
@@ -41,6 +41,7 @@ const Search: React.FC<{ isList?: Boolean }> = ({ isList }) => {
4141
className="flex-1 basis-[310px] [&_input]:py-0"
4242
type="text"
4343
placeholder="Search by keywords"
44+
aria-label="Search by keywords"
4445
value={search}
4546
onChange={(value) => setSearch(value)}
4647
/>
@@ -83,9 +84,9 @@ const Search: React.FC<{ isList?: Boolean }> = ({ isList }) => {
8384
callback={(item) => handleStatusChange(item.itemValue)}
8485
/>
8586
{isList ? (
86-
<Button text="Create New List" Icon={PaperIcon} onClick={() => navigate("/submit-list")} />
87+
<Button text="Create New List" Icon={PaperIcon} onPress={() => navigate("/submit-list")} />
8788
) : (
88-
<Button Icon={PlusIcon} text="Submit Item" onClick={() => navigate(`/submit-item/${id}`)} />
89+
<Button Icon={PlusIcon} text="Submit Item" onPress={() => navigate(`/submit-item/${id}`)} />
8990
)}
9091
</div>
9192
);

web/src/layout/Header/DesktopHeader.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ const DesktopHeader: React.FC = () => {
3535
<div className="hidden h-16 lg:flex lg:items-center lg:justify-between lg:w-full lg:relative">
3636
<div className="flex gap-2">
3737
<div className="flex items-center">
38-
<LightButton
39-
text=""
40-
onClick={() => {
41-
toggleIsDappListOpen();
42-
}}
43-
Icon={KlerosSolutionsIcon}
44-
/>
38+
<LightButton text="" onPress={toggleIsDappListOpen} Icon={KlerosSolutionsIcon} />
4539
</div>
4640
<Logo />
4741
</div>

0 commit comments

Comments
 (0)