Skip to content

Commit c4b0aef

Browse files
committed
fix: props type
1 parent 8c793b9 commit c4b0aef

File tree

2 files changed

+84
-79
lines changed

2 files changed

+84
-79
lines changed

src/pages/Index/components/MenuTile.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,26 @@ interface MenuTileProps {
1313
}
1414

1515
const MenuTile: React.FC<MenuTileProps> = (props) => {
16+
const handleClick: MouseEventHandler = (e) => {
17+
if (props.onClick) {
18+
props.onClick(e)
19+
}
20+
}
21+
1622
return (
17-
<Card
18-
shadow="single"
19-
onClick={props.onClick}
20-
css={[
21-
css`
22-
min-height: 8rem;
23-
cursor: ${props.onClick ? 'pointer' : 'inherit'};
24-
`,
25-
tw`p-4`,
26-
props.style || tw`bg-gray-100`,
27-
]}>
28-
{props.children}
29-
</Card>
23+
<div onClick={handleClick} css={[props.onClick && tw`cursor-pointer`]}>
24+
<Card
25+
shadow="single"
26+
css={[
27+
css`
28+
min-height: 8rem;
29+
`,
30+
tw`p-4`,
31+
props.style || tw`bg-gray-100`,
32+
]}>
33+
{props.children}
34+
</Card>
35+
</div>
3036
)
3137
}
3238

src/pages/Policies/components/PolicyGroup.tsx

Lines changed: 65 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -145,77 +145,76 @@ const PolicyGroup: React.FC<PolicyGroupProps> = ({
145145
}, [refreshSelection, isInViewport, selection])
146146

147147
return (
148-
<Card
149-
shadow="single"
150-
ref={targetRef}
151-
tw="relative overflow-hidden px-3 md:px-4">
152-
{isLoading && (
153-
<LoadingOverlay>
154-
<Spinner />
155-
</LoadingOverlay>
156-
)}
157-
158-
<Heading
159-
size="kilo"
160-
tw="flex flex-row justify-between items-center mb-3 md:mb-4">
161-
<div>{policyGroupName}</div>
162-
<IconButton
148+
<div ref={targetRef}>
149+
<Card shadow="single" tw="relative overflow-hidden px-3 md:px-4">
150+
{isLoading && (
151+
<LoadingOverlay>
152+
<Spinner />
153+
</LoadingOverlay>
154+
)}
155+
156+
<Heading
163157
size="kilo"
164-
label="test policy"
165-
onClick={() => testPolicy(policyGroupName)}>
166-
{isTesting ? (
167-
<Spinner tw="text-gray-700 w-5 h-5" />
168-
) : (
169-
<Zap tw="text-gray-700 w-5 h-5" />
170-
)}
171-
</IconButton>
172-
</Heading>
173-
174-
<div tw="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 md:gap-4">
175-
{policyGroup.map((policy) => {
176-
return (
177-
<div
178-
css={[
179-
tw`bg-gray-200 rounded-md px-3 py-3 md:px-4 md:py-3 cursor-pointer hover:bg-gray-300 transition-colors ease-in-out duration-200`,
180-
selection === policy.name
181-
? tw`bg-blue-600 text-white hover:bg-blue-600`
182-
: '',
183-
]}
184-
key={policy.name}
185-
onClick={() => selectPolicy(policy.name)}>
186-
<div tw="text-sm md:text-base leading-snug">{policy.name}</div>
158+
tw="flex flex-row justify-between items-center mb-3 md:mb-4">
159+
<div>{policyGroupName}</div>
160+
<IconButton
161+
size="kilo"
162+
label="test policy"
163+
onClick={() => testPolicy(policyGroupName)}>
164+
{isTesting ? (
165+
<Spinner tw="text-gray-700 w-5 h-5" />
166+
) : (
167+
<Zap tw="text-gray-700 w-5 h-5" />
168+
)}
169+
</IconButton>
170+
</Heading>
171+
172+
<div tw="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 md:gap-4">
173+
{policyGroup.map((policy) => {
174+
return (
187175
<div
188176
css={[
189-
tw`flex flex-row justify-between mt-2 text-xs text-gray-700`,
190-
selection === policy.name ? tw`text-white` : '',
191-
]}>
192-
<div tw="text-center bg-gray-400 text-gray-700 px-1 rounded">
193-
{policy.typeDescription.toUpperCase()}
177+
tw`bg-gray-200 rounded-md px-3 py-3 md:px-4 md:py-3 cursor-pointer hover:bg-gray-300 transition-colors ease-in-out duration-200`,
178+
selection === policy.name
179+
? tw`bg-blue-600 text-white hover:bg-blue-600`
180+
: '',
181+
]}
182+
key={policy.name}
183+
onClick={() => selectPolicy(policy.name)}>
184+
<div tw="text-sm md:text-base leading-snug">{policy.name}</div>
185+
<div
186+
css={[
187+
tw`flex flex-row justify-between mt-2 text-xs text-gray-700`,
188+
selection === policy.name ? tw`text-white` : '',
189+
]}>
190+
<div tw="text-center bg-gray-400 text-gray-700 px-1 rounded">
191+
{policy.typeDescription.toUpperCase()}
192+
</div>
193+
{latencies[policy.name] >= 0 && (
194+
<LatencyResult
195+
css={[
196+
tw`rounded px-1`,
197+
latencyResultStyle(latencies[policy.name]),
198+
]}>
199+
{latencies[policy.name] + 'ms'}
200+
</LatencyResult>
201+
)}
202+
{latencies[policy.name] === -1 && (
203+
<LatencyResult
204+
css={[
205+
tw`rounded px-1`,
206+
latencyResultStyle(latencies[policy.name]),
207+
]}>
208+
Failed
209+
</LatencyResult>
210+
)}
194211
</div>
195-
{latencies[policy.name] >= 0 && (
196-
<LatencyResult
197-
css={[
198-
tw`rounded px-1`,
199-
latencyResultStyle(latencies[policy.name]),
200-
]}>
201-
{latencies[policy.name] + 'ms'}
202-
</LatencyResult>
203-
)}
204-
{latencies[policy.name] === -1 && (
205-
<LatencyResult
206-
css={[
207-
tw`rounded px-1`,
208-
latencyResultStyle(latencies[policy.name]),
209-
]}>
210-
Failed
211-
</LatencyResult>
212-
)}
213212
</div>
214-
</div>
215-
)
216-
})}
217-
</div>
218-
</Card>
213+
)
214+
})}
215+
</div>
216+
</Card>
217+
</div>
219218
)
220219
}
221220

0 commit comments

Comments
 (0)