Skip to content

Commit 16180fa

Browse files
Fixes checkbox bug (#823)
1 parent b1c48c5 commit 16180fa

File tree

5 files changed

+44
-26
lines changed

5 files changed

+44
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export interface CheckboxProps {
2+
onClick?: () => void;
3+
containerClassName?: string;
4+
id?: string;
5+
label: string;
6+
dataCy?: string;
7+
}
8+
9+
function Checkbox({ onClick, containerClassName, id, label, dataCy }: CheckboxProps) {
10+
return (
11+
<div className={containerClassName}>
12+
<input
13+
type="checkbox"
14+
id={id}
15+
className="border-2 border-gray-600"
16+
onChange={onClick}
17+
data-cy={dataCy}
18+
/>
19+
<label htmlFor={id} className="ml-2">
20+
{label}
21+
</label>
22+
</div>
23+
);
24+
}
25+
26+
export default Checkbox;

web/beacon-app/src/features/topics/components/Modal/RevokeAPIKeyModal.tsx

+9-17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { t, Trans } from '@lingui/macro';
2-
import { Button, Checkbox, Modal } from '@rotational/beacon-core';
2+
import { Button, Modal } from '@rotational/beacon-core';
33
import { useEffect, useState } from 'react';
44
import toast from 'react-hot-toast';
5-
import styled from 'styled-components';
65

6+
import Checkbox from '@/components/common/Checkbox/Checkbox';
77
import { useDeleteAPIKey } from '@/features/apiKeys/hooks/useDeleteApiKey';
88
import { APIKey } from '@/features/apiKeys/types/apiKeyService';
99
type RevokeAPIKeyModalProps = {
@@ -92,15 +92,13 @@ const RevokeAPIKeyModal = ({ onOpen, onClose }: RevokeAPIKeyModalProps) => {
9292
<div className="pb-6" data-cy="api-key-name">
9393
<span className="font-bold">Key Name:</span> {key?.name}
9494
</div>
95-
<CheckboxFieldset onClick={handleCheckboxChange} className="pb-8" data-cy="revoke-checkbox">
96-
<div className="flex items-start">
97-
<Checkbox></Checkbox>
98-
<Trans>
99-
I understand that revoking the API key will cause publishers and subscribers to lose
100-
access to the event stream (topic) and may impact performance.
101-
</Trans>
102-
</div>
103-
</CheckboxFieldset>
95+
<Checkbox
96+
id="revokeApiKey"
97+
label={t`I understand that revoking the API key will cause publishers and subscribers to lose access to the event stream (topic) and may impact performance.`}
98+
containerClassName="pb-8"
99+
onClick={handleCheckboxChange}
100+
dataCy="revoke-api-key-checkbox"
101+
></Checkbox>
104102
<div className="mx-auto w-[150px] pb-4">
105103
<Button
106104
variant="secondary"
@@ -127,10 +125,4 @@ const RevokeAPIKeyModal = ({ onOpen, onClose }: RevokeAPIKeyModalProps) => {
127125
);
128126
};
129127

130-
const CheckboxFieldset = styled.fieldset`
131-
label svg {
132-
min-width: 23px;
133-
}
134-
`;
135-
136128
export default RevokeAPIKeyModal;

web/beacon-app/src/locales/cs/messages.po

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ msgstr ""
189189
msgid "CAUTION!"
190190
msgstr ""
191191

192-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:122
192+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:120
193193
msgid "Cancel"
194194
msgstr ""
195195

@@ -594,7 +594,7 @@ msgstr ""
594594
#~ msgid "I agree to the Rotational Labs Inc."
595595
#~ msgstr ""
596596

597-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:98
597+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:97
598598
msgid "I understand that revoking the API key will cause publishers and subscribers to lose access to the event stream (topic) and may impact performance."
599599
msgstr ""
600600

@@ -1007,7 +1007,7 @@ msgstr ""
10071007

10081008
#: src/features/projects/util.ts:45
10091009
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:71
1010-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:112
1010+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:110
10111011
msgid "Revoke API Key"
10121012
msgstr ""
10131013

web/beacon-app/src/locales/en/messages.po

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ msgstr "By continuing, you're agreeing to the Rotational Labs Inc."
189189
msgid "CAUTION!"
190190
msgstr "CAUTION!"
191191

192-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:122
192+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:120
193193
msgid "Cancel"
194194
msgstr "Cancel"
195195

@@ -594,7 +594,7 @@ msgstr "Home"
594594
#~ msgid "I agree to the Rotational Labs Inc."
595595
#~ msgstr "I agree to the Rotational Labs Inc."
596596

597-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:98
597+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:97
598598
msgid "I understand that revoking the API key will cause publishers and subscribers to lose access to the event stream (topic) and may impact performance."
599599
msgstr "I understand that revoking the API key will cause publishers and subscribers to lose access to the event stream (topic) and may impact performance."
600600

@@ -1007,7 +1007,7 @@ msgstr "Reset password request failed."
10071007

10081008
#: src/features/projects/util.ts:45
10091009
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:71
1010-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:112
1010+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:110
10111011
msgid "Revoke API Key"
10121012
msgstr "Revoke API Key"
10131013

web/beacon-app/src/locales/fr/messages.po

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ msgstr ""
189189
msgid "CAUTION!"
190190
msgstr ""
191191

192-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:122
192+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:120
193193
msgid "Cancel"
194194
msgstr ""
195195

@@ -594,7 +594,7 @@ msgstr ""
594594
#~ msgid "I agree to the Rotational Labs Inc."
595595
#~ msgstr ""
596596

597-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:98
597+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:97
598598
msgid "I understand that revoking the API key will cause publishers and subscribers to lose access to the event stream (topic) and may impact performance."
599599
msgstr ""
600600

@@ -1007,7 +1007,7 @@ msgstr ""
10071007

10081008
#: src/features/projects/util.ts:45
10091009
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:71
1010-
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:112
1010+
#: src/features/topics/components/Modal/RevokeAPIKeyModal.tsx:110
10111011
msgid "Revoke API Key"
10121012
msgstr ""
10131013

0 commit comments

Comments
 (0)