fix: restore show episodes border style

This commit is contained in:
Hossein Mehrabi 2023-08-24 22:05:44 +03:30
parent 6ecdc38d52
commit 1583ca83be
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
2 changed files with 31 additions and 4 deletions

View File

@ -86,6 +86,7 @@ type Pattern = {
cols: number cols: number
maxWidth?: string maxWidth?: string
size: PostCardProps['size'] size: PostCardProps['size']
rowBorder?: boolean
} }
type Breakpoint = { type Breakpoint = {
pattern: Pattern[] pattern: Pattern[]
@ -103,7 +104,7 @@ const createGridStyles = ({
postCardStyles: { postCardStyles: {
[name: string]: SerializedStyles [name: string]: SerializedStyles
} }
pattern: Pick<Pattern, 'cols' | 'size' | 'maxWidth'>[] pattern: Pick<Pattern, 'cols' | 'size' | 'maxWidth' | 'rowBorder'>[]
breakpoint?: boolean breakpoint?: boolean
horizontal?: boolean horizontal?: boolean
}) => { }) => {
@ -130,12 +131,27 @@ const createGridStyles = ({
> .row { > .row {
display: grid; display: grid;
grid-template-columns: repeat(${cm}, 1fr); grid-template-columns: repeat(${cm}, 1fr);
overflow: hidden;
& > div { & > div {
${pattern.map( ${pattern.map(
(p, i) => css` (p, i) => css`
${selectors[i].map((s) => `&:nth-child(${s})`).join(', ')} { ${selectors[i].map((s) => `&:nth-child(${s})`).join(', ')} {
grid-column: span ${cm / p.cols}; grid-column: span ${cm / p.cols};
position: relative;
${p.rowBorder &&
css`
&::before {
width: calc(100% + 16px);
height: 1px;
content: ' ';
top: 0;
left: 0px;
position: absolute;
background: rgb(var(--lsd-border-primary));
}
`}
.post-card { .post-card {
--post-card-size: ${p.size}; --post-card-size: ${p.size};

View File

@ -91,19 +91,30 @@ export const PodcastShowsPreview: React.FC<PodcastShowsPreviewProps> = ({
cols: 2, cols: 2,
size: 'xsmall', size: 'xsmall',
}, },
{
cols: 2,
size: 'xsmall',
rowBorder: true,
},
]} ]}
breakpoints={[ breakpoints={[
{ {
breakpoint: 'xs', breakpoint: 'xs',
pattern: [{ cols: 1, size: 'small' }], pattern: [{ cols: 1, size: 'small', rowBorder: true }],
}, },
{ {
breakpoint: 'sm', breakpoint: 'sm',
pattern: [{ cols: 2, size: 'small' }], pattern: [
{ cols: 2, size: 'small' },
{ cols: 2, size: 'small', rowBorder: true },
],
}, },
{ {
breakpoint: 'md', breakpoint: 'md',
pattern: [{ cols: 2, size: 'small' }], pattern: [
{ cols: 2, size: 'small' },
{ cols: 2, size: 'small', rowBorder: true },
],
}, },
]} ]}
/> />