Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 2x 2x 2x 2x | // @flow strict
import React from 'react';
import Example from '../Example';
import Card from '../material-toolbox/card';
import CardMedia from '../material-toolbox/card/Media';
import CardPrimaryAction from '../material-toolbox/card/PrimaryAction';
import CommonContent from './CommonContent';
const source = `import Text from 'material-toolbox/typography/Text';
import Card from 'material-toolbox/card/Card';
import CardMedia from 'material-toolbox/card/Media';
import CardPrimaryAction from 'material-toolbox/card/PrimaryAction';
const WithImage = () => (
<Card className="demo-card">
<CardPrimaryAction>
<CardMedia
ratio169
style={{
'background-image':
'url("https://material-components.github.io/material-components-web-catalog/static/media/photos/3x2/2.jpg")',
}}
/>
<div className="demo-card__primary">
<Text text="headline6" as="h2" className="demo-card__title">
Our Changing Planet
</Text>
<Text text="subtitle2" as="h3" className="demo-card__subtitle">
by Kurt Wagner
</Text>
</div>
<Text className="demo-card__secondary" text="body2" as="div">
Visit ten places on our planet that are undergoing the biggest changes
today.
</Text>
</CardPrimaryAction>
</Card>
);
export default WithImage;`;
const scssSource = `.demo-card {
width: 350px;
margin: 48px 0;
&__primary {
padding: 1rem;
}
&__title,
&__subtitle {
margin: 0;
}
&__secondary {
padding: 0 1rem 8px;
}
&__secondary,
&__subtitle {
color: rgba(0, 0, 0, 0.54);
color: var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54));
}
&-shaped {
border-radius: 24px 8px;
}
}`;
const WithImage = () => (
<Example title="With image" source={source} scss={scssSource}>
<Card className="demo-card">
<CardPrimaryAction>
<CardMedia
ratio169
style={{
backgroundImage:
'url("https://material-components.github.io/material-components-web-catalog/static/media/photos/3x2/2.jpg")',
}}
/>
<CommonContent />
</CardPrimaryAction>
</Card>
</Example>
);
export default WithImage;
|