Skip to content

Commit cd3d07f

Browse files
authored
chore/add spacing tokens (#45)
* add spacing tokens * fix text area overflow * upd padding token; fix input height; fix caption margin
1 parent e3674bf commit cd3d07f

File tree

6 files changed

+45
-15
lines changed

6 files changed

+45
-15
lines changed

packages/blinks/src/index.css

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
--blink-border-radius-rounded-input: 0.5rem;
7070
--blink-border-radius-rounded-input-standalone: 0.5rem;
7171

72+
--blink-spacing-padding: 1.25rem;
73+
--blink-spacing-gap: 1rem;
74+
--blink-spacing-btwn-buttons: 0.5rem;
75+
--blink-spacing-btwn-inputs: 0.75rem;
76+
--blink-spacing-input-height: 40px;
77+
7278
--blink-shadow-container: 0px 129.333px 103.467px 0px rgba(0, 0, 0, 0.07), 0px 54.032px 43.226px 0px rgba(0, 0, 0, 0.05), 0px 16.195px 12.956px 0px rgba(0, 0, 0, 0.04), 0px 8.601px 6.881px 0px rgba(0, 0, 0, 0.03), 0px 3.579px 2.863px 0px rgba(0, 0, 0, 0.02);
7379
}
7480

@@ -79,6 +85,13 @@
7985
--blink-border-radius-rounded-button: 624.9375rem;
8086
--blink-border-radius-rounded-input: 1.25rem;
8187
--blink-border-radius-rounded-input-standalone: 1.75rem;
88+
89+
--blink-spacing-padding: 1.25rem;
90+
--blink-spacing-gap: 1rem;
91+
--blink-spacing-btwn-buttons: 0.5rem;
92+
--blink-spacing-btwn-inputs: 0.75rem;
93+
--blink-spacing-input-height: 40px;
94+
8295
}
8396

8497
.x-dark {
@@ -177,5 +190,13 @@
177190
--blink-shadow-container: 0px 2px 8px 0px rgba(62, 177, 255, 0.22), 0px 1px 48px 0px rgba(62, 177, 255, 0.24);
178191
}
179192

180-
.custom {}
181-
}
193+
.custom {
194+
195+
/* this will be removed in future versions */
196+
--blink-spacing-padding: 1.25rem;
197+
--blink-spacing-gap: 1rem;
198+
--blink-spacing-btwn-buttons: 0.5rem;
199+
--blink-spacing-btwn-inputs: 0.75rem;
200+
--blink-spacing-input-height: 40px;
201+
}
202+
}

packages/blinks/src/ui/internal/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const Button = ({
1818
return (
1919
<button
2020
className={clsx(
21-
'rounded-button text-text relative flex w-full items-center justify-center text-nowrap px-4 py-3 font-semibold transition-colors motion-reduce:transition-none',
21+
'rounded-button text-text h-input-height relative flex w-full items-center justify-center text-nowrap px-4 py-3 font-semibold transition-colors motion-reduce:transition-none',
2222
{
2323
'px-5': isLink,
2424
'bg-button-disabled text-text-button-disabled':

packages/blinks/src/ui/internal/inputs/ActionTextArea.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const ActionTextArea = ({
7272
}
7373
>
7474
<textarea
75+
className="my-1.5 whitespace-normal"
7576
placeholder={placeholderWithRequired}
7677
value={value}
7778
onChange={extendedChange}

packages/blinks/src/ui/internal/inputs/BaseInputContainer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ export const BaseInputContainer = ({
3434
<div>
3535
<div
3636
className={clsx(
37-
'border-input-stroke peer relative flex min-h-10 flex-wrap items-center gap-1.5 gap-y-2 border p-1.5 transition-colors motion-reduce:transition-none',
37+
'border-input-stroke min-h-input-height peer relative box-border flex flex-wrap items-center gap-1.5 gap-y-2 border px-1.5 transition-colors motion-reduce:transition-none',
3838
// focus, invalid, required
3939
'focus-within:has-[:invalid]:border-input-stroke-error focus-within:has-[:valid]:border-input-stroke-selected focus-within:hover:has-[:invalid]:border-input-stroke-error focus-within:hover:has-[:valid]:border-input-stroke-selected',
4040
// enabled,
4141
'hover:has-[:enabled]:border-input-stroke-hover',
42+
{ 'py-1.5': !!rightAdornment },
4243
standalone ? 'rounded-input-standalone' : 'rounded-input',
4344
)}
4445
>

packages/blinks/src/ui/layouts/BaseBlinkLayout.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export const BaseBlinkLayout = ({
206206
{image && (
207207
<Linkable
208208
url={websiteUrl}
209-
className="block max-h-[100cqw] overflow-y-hidden px-5 pt-5"
209+
className="px-padding pt-padding block max-h-[100cqw] overflow-y-hidden"
210210
>
211211
<img
212212
className={clsx(
@@ -217,8 +217,8 @@ export const BaseBlinkLayout = ({
217217
/>
218218
</Linkable>
219219
)}
220-
<div className="flex flex-col p-5">
221-
<div className="mb-1 flex items-center gap-2">
220+
<div className="px-padding pb-padding pt-gap flex flex-col">
221+
<div className="mb-1.5 flex items-center gap-2">
222222
{websiteUrl && (
223223
<a
224224
href={websiteUrl}
@@ -265,10 +265,10 @@ export const BaseBlinkLayout = ({
265265
)}
266266
</a>
267267
</div>
268-
<span className="text-text text-text-primary mb-1.5 break-words font-semibold">
268+
<span className="text-text text-text-primary mb-1 break-words font-semibold">
269269
{title}
270270
</span>
271-
<span className="text-subtext text-text-secondary mb-4 break-words">
271+
<span className="text-subtext text-text-secondary mb-gap break-words">
272272
{description && <SimpleMarkdown text={description} />}
273273
</span>
274274
{!supportability.isSupported ? (
@@ -277,7 +277,7 @@ export const BaseBlinkLayout = ({
277277
<>
278278
{disclaimer && (
279279
<DisclaimerBlock
280-
className="mb-4"
280+
className="mb-gap"
281281
type={disclaimer.type}
282282
ignorable={disclaimer.ignorable}
283283
hidden={
@@ -299,12 +299,12 @@ export const BaseBlinkLayout = ({
299299
buttons={buttons}
300300
/>
301301
{success && (
302-
<span className="text-subtext text-text-success mt-1.5 flex justify-center">
302+
<span className="text-subtext text-text-success mt-between-inputs flex justify-center">
303303
{success}
304304
</span>
305305
)}
306306
{error && !success && (
307-
<span className="text-subtext text-text-error mt-1.5 flex justify-center">
307+
<span className="text-subtext text-text-error mt-between-inputs flex justify-center">
308308
{error}
309309
</span>
310310
)}
@@ -337,9 +337,9 @@ export const ActionContent = ({
337337
}
338338

339339
return (
340-
<div className="flex flex-col gap-4">
340+
<div className="gap-between-inputs flex flex-col">
341341
{buttons && buttons.length > 0 && (
342-
<div className="flex flex-wrap items-center gap-2">
342+
<div className="gap-between-buttons flex flex-wrap items-center">
343343
{buttons?.map((it, index) => (
344344
<div
345345
key={index}
@@ -397,7 +397,7 @@ const ActionForm = ({ form }: Required<Pick<InnerLayoutProps, 'form'>>) => {
397397
const disabled = Object.values(validity).some((v) => !v);
398398

399399
return (
400-
<div className="flex flex-col gap-3">
400+
<div className="gap-between-inputs flex flex-col">
401401
{form.inputs.map((input) => (
402402
<ActionInputFactory
403403
key={input.name}

packages/blinks/tailwind.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ export default {
6969
boxShadow: {
7070
action: 'var(--blink-shadow-container)',
7171
},
72+
spacing: {
73+
padding: 'var(--blink-spacing-padding)',
74+
gap: 'var(--blink-spacing-gap)',
75+
'between-buttons': 'var(--blink-spacing-btwn-buttons)',
76+
'between-inputs': 'var(--blink-spacing-btwn-inputs)',
77+
'input-height': 'var(--blink-spacing-input-height)',
78+
},
7279
},
7380
},
7481
plugins: [],

0 commit comments

Comments
 (0)