COMPLETED: Card sub-components
TODO: fixed styles for :active state
This commit is contained in:
parent
d0a34e7a1f
commit
c83d1f4232
57
app/page.tsx
57
app/page.tsx
|
@ -20,7 +20,7 @@ export default function Page() {
|
||||||
padding: '8px',
|
padding: '8px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ display: 'flex', gap: '8px', maxWidth: 512 }}>
|
<div style={{ display: 'flex', gap: '8px', maxWidth: 1024 }}>
|
||||||
<Card variant={'outlined'}>
|
<Card variant={'outlined'}>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<h1>Header</h1>
|
<h1>Header</h1>
|
||||||
|
@ -50,6 +50,61 @@ export default function Page() {
|
||||||
<Button>label</Button>
|
<Button>label</Button>
|
||||||
</CardFooter>
|
</CardFooter>
|
||||||
</Card>
|
</Card>
|
||||||
|
<Card variant={'elevated'}>
|
||||||
|
<CardMedia src={testImage1.src} type={'img'} />
|
||||||
|
<CardActionArea>
|
||||||
|
<CardBody>
|
||||||
|
<h4>
|
||||||
|
<strong>Sub-header</strong>
|
||||||
|
</h4>
|
||||||
|
<p>
|
||||||
|
Lorem ipsum dolor sit amet, consecrate
|
||||||
|
adipiscing elit, sed do eiusmod tempor
|
||||||
|
incididunt ut labore et dolore magna aliqua.
|
||||||
|
Ut enim ad minim veniam, quis nostrud
|
||||||
|
exercitation ullamco laboris nisi ut aliquip
|
||||||
|
ex ea commodo consequat. Duis aute irure
|
||||||
|
dolor in reprehenderit in voluptate velit
|
||||||
|
esse cillum dolore eu fugiat nulla pariatur.
|
||||||
|
Excepteur sint occaecat cupidatat non
|
||||||
|
proident, sunt in culpa qui officia deserunt
|
||||||
|
mollit anim id est laborum.
|
||||||
|
</p>
|
||||||
|
</CardBody>
|
||||||
|
</CardActionArea>
|
||||||
|
<CardFooter>
|
||||||
|
<Button>label</Button>
|
||||||
|
</CardFooter>
|
||||||
|
</Card>
|
||||||
|
<Card variant={'elevated'}>
|
||||||
|
<CardHeader>
|
||||||
|
<h1>Header</h1>
|
||||||
|
</CardHeader>
|
||||||
|
<CardMedia src={testImage1.src} type={'img'} />
|
||||||
|
<CardActionArea>
|
||||||
|
<CardBody>
|
||||||
|
<h4>
|
||||||
|
<strong>Sub-header</strong>
|
||||||
|
</h4>
|
||||||
|
<p>
|
||||||
|
Lorem ipsum dolor sit amet, consecrate
|
||||||
|
adipiscing elit, sed do eiusmod tempor
|
||||||
|
incididunt ut labore et dolore magna aliqua.
|
||||||
|
Ut enim ad minim veniam, quis nostrud
|
||||||
|
exercitation ullamco laboris nisi ut aliquip
|
||||||
|
ex ea commodo consequat. Duis aute irure
|
||||||
|
dolor in reprehenderit in voluptate velit
|
||||||
|
esse cillum dolore eu fugiat nulla pariatur.
|
||||||
|
Excepteur sint occaecat cupidatat non
|
||||||
|
proident, sunt in culpa qui officia deserunt
|
||||||
|
mollit anim id est laborum.
|
||||||
|
</p>
|
||||||
|
</CardBody>
|
||||||
|
</CardActionArea>
|
||||||
|
<CardFooter>
|
||||||
|
<Button>label</Button>
|
||||||
|
</CardFooter>
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -2,20 +2,26 @@
|
||||||
|
|
||||||
$padding: 16px
|
$padding: 16px
|
||||||
|
|
||||||
.m3:not(:first-child):is(.m3-card)
|
@function padding-calculating($has-padding)
|
||||||
padding: $padding
|
@if($has-padding == true)
|
||||||
|
@return $padding
|
||||||
|
@else
|
||||||
|
@return 0px
|
||||||
|
|
||||||
:is(div.m3-card-footer, header.m3-card-header, section.m3-card-body).m3
|
div.m3.m3-card > .m3-card-media:first-child
|
||||||
padding: $padding
|
padding: padding-calculating(false)
|
||||||
|
border-radius: 12px !important
|
||||||
|
|
||||||
|
:is(div.m3-card-footer, header.m3-card-header, section.m3-card-body, img.m3-card-media).m3
|
||||||
|
padding: padding-calculating(true)
|
||||||
display: block
|
display: block
|
||||||
box-sizing: border-box
|
box-sizing: border-box
|
||||||
|
|
||||||
.m3.m3-card-media
|
.m3.m3-card-media
|
||||||
&.m3-rounded
|
&.m3-rounded
|
||||||
border-radius: 12px
|
border-radius: 12px + padding-calculating(true)
|
||||||
|
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 100%
|
|
||||||
display: block
|
display: block
|
||||||
contain: content
|
contain: content
|
||||||
position: relative
|
position: relative
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
@import "./themes/typography.module.css";
|
@import "./themes/typography.module.css";
|
||||||
@import "./themes/theme.dark.css" (prefers-color-scheme: dark);
|
@import "./themes/theme.dark.css" (prefers-color-scheme: dark);
|
||||||
@import "./themes/theme.light.css" (prefers-color-scheme: light);
|
@import "./themes/theme.light.css" (prefers-color-scheme: light);
|
||||||
.m3:not(:first-child):is(.m3-card) {
|
div.m3.m3-card > .m3-card-media:first-child {
|
||||||
padding: 16px;
|
padding: 0px;
|
||||||
|
border-radius: 12px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:is(div.m3-card-footer, header.m3-card-header, section.m3-card-body).m3 {
|
:is(div.m3-card-footer, header.m3-card-header, section.m3-card-body, img.m3-card-media).m3 {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -15,14 +16,13 @@
|
||||||
|
|
||||||
.m3.m3-card-media {
|
.m3.m3-card-media {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
|
||||||
display: block;
|
display: block;
|
||||||
contain: content;
|
contain: content;
|
||||||
position: relative;
|
position: relative;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.m3.m3-card-media.m3-rounded {
|
.m3.m3-card-media.m3-rounded {
|
||||||
border-radius: 12px;
|
border-radius: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.m3.m3-card-action-area {
|
div.m3.m3-card-action-area {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue