Skip to content

Commit ecd907f

Browse files
committed
feat: improve responsive styling
1 parent 7d7cd40 commit ecd907f

File tree

2 files changed

+51
-39
lines changed

2 files changed

+51
-39
lines changed

src/modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const WebhookFormModal = ({
6767
/>
6868
</Stack>
6969

70-
<Grid columns={2} gap={3}>
70+
<Grid columns={[1, 1, 2]} gap={4}>
7171
<Stack space={3}>
7272
<Label htmlFor="webhook-method">Method</Label>
7373
<Select
@@ -81,7 +81,7 @@ const WebhookFormModal = ({
8181
<option value="GET">GET</option>
8282
</Select>
8383
</Stack>
84-
<Stack width="50%" space={3}>
84+
<Stack space={3}>
8585
<Label htmlFor="webhook-auth-token">Auth Token (Optional)</Label>
8686
<TextInput
8787
id="webhook-auth-token"

src/webhooks-trigger.tsx

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ const WebhooksTrigger = ({tool}: WebhooksTriggerConfig): ReactElement => {
186186
<Container width={2}>
187187
{/* Intro text */}
188188
<Box padding={4} marginTop={5}>
189-
<Flex gap={4} align="flex-start">
190-
<Stack space={4}>
189+
<Flex gap={4} align="flex-start" direction={["column", "column", "row"]} justify={["flex-start", "flex-start", "space-between"]}>
190+
<Stack space={4} style={{flex: 1, minWidth: 0}}>
191191
<Heading as="h2" size={3}>
192192
Deploy via Webhooks
193193
</Heading>
@@ -196,34 +196,46 @@ const WebhooksTrigger = ({tool}: WebhooksTriggerConfig): ReactElement => {
196196
</Text>
197197
</Stack>
198198

199-
<Card style={{marginLeft: 'auto'}}>
199+
<Box style={{flexShrink: 0}}>
200200
<Button icon={AddIcon} text="Add Webhook" tone="primary" onClick={handleAddWebhook} />
201-
</Card>
201+
</Box>
202202
</Flex>
203203

204204
{/* Has items */}
205205
{webhooks.length > 0 ? (
206-
<Stack space={4} marginTop={6}>
206+
<Stack space={4} marginTop={[5, 5, 6]}>
207207
{webhooks.map((webhook) => (
208208
<Card key={webhook._id} padding={3} radius={2} shadow={1}>
209-
<Flex justify="space-between" align="flex-start">
209+
<Flex align="flex-start" direction={["column", "column", "row"]} justify={["flex-start", "flex-start", "space-between"]}>
210210
<Stack space={1}>
211211
<Heading as="h3" size={1} style={{marginBottom: '0.5em'}}>
212212
{webhook.name}
213213
</Heading>
214214

215-
<Flex gap={1} align="center">
215+
<Box
216+
style={{
217+
display: 'grid',
218+
gridTemplateColumns: `${webhook.authToken ? 'auto ' : ''}minmax(0, 1fr) auto`,
219+
alignItems: 'center',
220+
columnGap: 4,
221+
width: '100%',
222+
}}
223+
>
216224
{webhook.authToken && <TokenIcon fontSize={'1em'} />}
217-
<Text size={1} muted>
218-
{webhook.url} ({webhook.method})
225+
<Text size={1} muted title={webhook.url} textOverflow="ellipsis">
226+
{webhook.url}
219227
</Text>
220-
</Flex>
228+
<Text size={1} muted style={{whiteSpace: 'nowrap'}}>
229+
({webhook.method})
230+
</Text>
231+
</Box>
221232

222233
{webhook.lastRunTime && webhook.lastRunStatus && (
223234
<Flex gap={1} align="center">
224235
<ClockIcon
225236
fontSize={'1em'}
226237
color={webhook.lastRunStatus === 'success' ? 'green' : 'red'}
238+
style={{flexShrink: 0}}
227239
/>
228240
<Text size={1} muted>
229241
Last {webhook.lastRunStatus === 'success' ? 'successful' : 'failed'}{' '}
@@ -233,39 +245,39 @@ const WebhooksTrigger = ({tool}: WebhooksTriggerConfig): ReactElement => {
233245
)}
234246
</Stack>
235247

236-
<Flex>
237-
<Button
238-
tone="positive"
239-
onClick={() => handleTriggerWebhook(webhook)}
240-
disabled={triggeringWebhook === webhook._id}
241-
style={{marginRight: '8px'}}
242-
>
243-
{triggeringWebhook === webhook._id ? (
244-
<Spinner size={1} />
245-
) : (
246-
<Text size={1}>Trigger</Text>
247-
)}
248-
</Button>
249-
<Button
250-
icon={EditIcon}
251-
tone="default"
252-
onClick={() => handleEditWebhook(webhook)}
253-
style={{marginRight: '8px'}}
254-
/>
255-
<Button
256-
icon={deletingWebhook === webhook._id ? Spinner : TrashIcon}
257-
tone="default"
258-
onClick={() => handleDeleteWebhook(webhook)}
259-
disabled={deletingWebhook === webhook._id}
260-
/>
261-
</Flex>
248+
<Box marginTop={[3, 3, 0]}>
249+
<Flex gap={2} wrap="wrap" justify={["flex-start", "flex-start", "flex-end"]}>
250+
<Button
251+
tone="positive"
252+
onClick={() => handleTriggerWebhook(webhook)}
253+
disabled={triggeringWebhook === webhook._id}
254+
>
255+
{triggeringWebhook === webhook._id ? (
256+
<Spinner size={1} />
257+
) : (
258+
<Text size={1}>Trigger</Text>
259+
)}
260+
</Button>
261+
<Button
262+
icon={EditIcon}
263+
tone="default"
264+
onClick={() => handleEditWebhook(webhook)}
265+
/>
266+
<Button
267+
icon={deletingWebhook === webhook._id ? Spinner : TrashIcon}
268+
tone="default"
269+
onClick={() => handleDeleteWebhook(webhook)}
270+
disabled={deletingWebhook === webhook._id}
271+
/>
272+
</Flex>
273+
</Box>
262274
</Flex>
263275
</Card>
264276
))}
265277
</Stack>
266278
) : (
267279
// No items: Show a message with a button
268-
<Card padding={4} radius={2} shadow={1} marginTop={6}>
280+
<Card padding={4} radius={2} shadow={1} marginTop={[5, 5, 6]}>
269281
<Flex direction="column" align="center" gap={3}>
270282
<Card paddingY={5}>
271283
<Text>No webhook yet</Text>

0 commit comments

Comments
 (0)