Added basic styling to RecipeCard.
This commit is contained in:
parent
509f5292fc
commit
606d0f4b63
@ -1,4 +1,5 @@
|
|||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||||
|
import classes from './recipe-card.module.css'
|
||||||
|
|
||||||
export interface RecipeCardProps {
|
export interface RecipeCardProps {
|
||||||
title: string
|
title: string
|
||||||
@ -18,22 +19,23 @@ const RecipeCard = ({
|
|||||||
isPublic
|
isPublic
|
||||||
}: RecipeCardProps) => {
|
}: RecipeCardProps) => {
|
||||||
return (
|
return (
|
||||||
<article>
|
<article className={classes.recipeCard}>
|
||||||
<img src={mainImageUrl} alt={mainImageAlt} title={mainImageAlt} />
|
<img
|
||||||
<div className="title-star-count-container">
|
className={classes.recipeImage}
|
||||||
<h1>{title}</h1>
|
src={mainImageUrl}
|
||||||
|
alt={mainImageAlt}
|
||||||
|
title={mainImageAlt}
|
||||||
|
/>
|
||||||
|
<div className={classes.infoContainer}>
|
||||||
|
<h1 className={classes.title}>{title}</h1>
|
||||||
<span>
|
<span>
|
||||||
<FontAwesomeIcon icon="star" size="sm" />
|
<FontAwesomeIcon icon="star" size="sm" />
|
||||||
{starCount}
|
{starCount}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
|
||||||
<div className="owner-container">
|
|
||||||
<span>
|
<span>
|
||||||
<FontAwesomeIcon icon="user" />
|
<FontAwesomeIcon icon="user" />
|
||||||
{ownerUsername}
|
{ownerUsername}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
|
||||||
<div className="is-public-container">
|
|
||||||
{isPublic ? (
|
{isPublic ? (
|
||||||
<FontAwesomeIcon icon="globe" size="sm" />
|
<FontAwesomeIcon icon="globe" size="sm" />
|
||||||
) : (
|
) : (
|
||||||
|
18
src/components/recipe-card/recipe-card.module.css
Normal file
18
src/components/recipe-card/recipe-card.module.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
.recipe-card {
|
||||||
|
max-width: 400px;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recipe-image {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
align-items: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin-block: 0;
|
||||||
|
}
|
@ -4,5 +4,10 @@ import { TanStackRouterVite } from '@tanstack/router-vite-plugin'
|
|||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(), TanStackRouterVite()]
|
plugins: [react(), TanStackRouterVite()],
|
||||||
|
css: {
|
||||||
|
modules: {
|
||||||
|
localsConvention: 'camelCaseOnly'
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user