Skip to content

Commit ece313e

Browse files
Merge pull request #74 from linked-planet/book-card-width-fixes
box border on card components
2 parents 8de2f3b + 4e0280f commit ece313e

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

library/src/components/BookCard.tsx

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export const CardBase = forwardRef(
5050
defaultOpen={defaultOpen}
5151
onChanged={onOpenChanged}
5252
className={twMerge(
53-
"border-border shadow-overlay-bold border",
53+
"border-border box-border shadow-overlay-bold border",
5454
className,
5555
)}
56-
triggerClassName="rounded-t border-b border-border overflow-hidden"
56+
triggerClassName="rounded-t border-b box-border border-border overflow-hidden"
5757
id={id}
5858
testId={testId}
5959
ref={ref}
@@ -82,7 +82,7 @@ const CardHeaderPrefix = ({
8282
testId?: string
8383
}) => {
8484
const _className = twMerge(
85-
"text-text-subtlest pr-2 mr-4 text-xs border-border border-r w-[100px] flex-none font-semibold grid items-center justify-start",
85+
"text-text-subtlest pr-2 mr-4 box-border text-xs border-border border-r w-[100px] flex-none font-semibold grid items-center justify-start",
8686
className,
8787
)
8888
return (
@@ -113,7 +113,7 @@ const CardHeader = ({
113113
}) => (
114114
<div
115115
className={twMerge(
116-
"bg-surface-overlay flex w-full max-w-fit flex-1 justify-between px-4 py-3",
116+
"bg-surface-overlay box-border flex w-full flex-1 justify-between px-4 py-3",
117117
className,
118118
)}
119119
style={style}
@@ -139,7 +139,7 @@ const CardHeaderMeta = ({
139139
testId?: string
140140
}) => (
141141
<div
142-
className="w-full items-baseline overflow-hidden"
142+
className="w-full items-baseline box-border overflow-hidden"
143143
id={id}
144144
data-testid={testId}
145145
>
@@ -163,7 +163,7 @@ const CardHeaderTitle = ({
163163
prefixStyle?: CSSProperties
164164
}) => {
165165
const _className = twMerge(
166-
"mt-0 truncate text-start text-xl font-medium",
166+
"mt-0 truncate box-border text-start text-xl font-medium",
167167
className,
168168
)
169169

@@ -205,7 +205,7 @@ const CardHeaderSubtitle = ({
205205
id?: string
206206
}) => {
207207
const _className = twMerge(
208-
"text-text-subtlest mt-1 flex-1 justify-start truncate text-start text-sm font-semibold",
208+
"text-text-subtlest box-border mt-1 flex-1 justify-start truncate text-start text-sm font-semibold",
209209
className,
210210
)
211211
if (typeof children === "string") {
@@ -241,7 +241,7 @@ const CardHeaderUpperTitle = ({
241241
id?: string
242242
}) => {
243243
const _className = twMerge(
244-
"text-text-subtlest my-1 w-full flex-1 justify-start truncate text-start text-xs font-light italic",
244+
"text-text-subtlest box-border my-1 w-full flex-1 justify-start truncate text-start text-xs font-light italic",
245245
className,
246246
)
247247
if (typeof children === "string") {
@@ -273,7 +273,7 @@ const CardHeaderActions = ({
273273
testId?: string
274274
}) => (
275275
<div
276-
className="flex flex-none items-center justify-end pl-2"
276+
className="flex flex-none box-border items-center justify-end pl-2"
277277
id={id}
278278
data-testid={testId}
279279
>
@@ -290,7 +290,11 @@ const CardHeaderActionsInfo = ({
290290
id?: string
291291
testId?: string
292292
}) => (
293-
<div className="mr-2 items-center text-sm" id={id} data-testid={testId}>
293+
<div
294+
className="mr-2 box-border items-center text-sm"
295+
id={id}
296+
data-testid={testId}
297+
>
294298
{children}
295299
</div>
296300
)
@@ -316,13 +320,13 @@ const CardGridBody = ({
316320
style?: CSSProperties
317321
}) => (
318322
<div
319-
className="w-full overflow-hidden rounded-b"
323+
className="w-full overflow-hidden box-border rounded-b"
320324
is={id}
321325
data-testid={testId}
322326
>
323327
<div
324328
className={twMerge(
325-
`grid border-collapse overflow-hidden ${cardBodyEntryBaseStyle} ${css`
329+
`grid border-collapse box-border overflow-hidden ${cardBodyEntryBaseStyle} ${css`
326330
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
327331
`}`,
328332
className,
@@ -343,9 +347,13 @@ const CardRowBody = ({
343347
id?: string
344348
testId?: string
345349
}) => (
346-
<div className="overflow-hidden rounded-b" id={id} data-testid={testId}>
350+
<div
351+
className="overflow-hidden rounded-b box-border"
352+
id={id}
353+
data-testid={testId}
354+
>
347355
<div
348-
className={`grid border-collapse grid-flow-col overflow-x-auto overflow-y-hidden ${cardBodyEntryBaseStyle} ${css`
356+
className={`grid border-collapse grid-flow-col box-border overflow-x-auto overflow-y-hidden ${cardBodyEntryBaseStyle} ${css`
349357
grid-auto-columns: minmax(150px, 1fr);
350358
`}`}
351359
>
@@ -363,9 +371,13 @@ const CardColumnBody = ({
363371
id?: string
364372
testId?: string
365373
}) => (
366-
<div className="overflow-hidden rounded-b" id={id} data-testid={testId}>
374+
<div
375+
className="overflow-hidden rounded-b box-border"
376+
id={id}
377+
data-testid={testId}
378+
>
367379
<div
368-
className={`grid border-collapse grid-flow-row overflow-auto ${cardBodyEntryBaseStyle} ${css`
380+
className={`grid border-collapse box-border grid-flow-row overflow-auto ${cardBodyEntryBaseStyle} ${css`
369381
grid-auto-rows: minmax(150px, 1fr);
370382
`}`}
371383
>

tailwind.config.sc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,7 @@ export default {
1212
],
1313
theme,
1414
plugins: [],
15+
corePlugins: {
16+
preflight: true,
17+
},
1518
}

0 commit comments

Comments
 (0)