Skip to content

Commit

Permalink
feat: add card component
Browse files Browse the repository at this point in the history
  • Loading branch information
igtiago committed Feb 11, 2023
1 parent df9362d commit 1d75232
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/components/card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { FiTrash2 } from 'react-icons/fi';

import Button from '../button';

import {
Buttons,
Container,
Content,
Image,
Price,
Prices,
Title,
} from './style';

interface CardProps {
thumbnail?: string;
}

export default function Card({ thumbnail }: CardProps) {
return (
<Container onClick={() => console.log('Card clicked!')}>
<Image src={thumbnail} alt="" srcSet={thumbnail} />
<Content>
<Title>Product</Title>
<Prices>
<Price>100</Price>
<Price>40</Price>
</Prices>
</Content>
<Buttons style={{ justifyContent: 'flex-end' }}>
<Button color="#F80059">
<FiTrash2 color="#FFF" />
</Button>
<Button
onClick={(e) => {
console.log('Button clicked!');
}}
>
Editar
</Button>
</Buttons>
</Container>
);
}
39 changes: 39 additions & 0 deletions src/components/card/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import styled from 'styled-components';

export const Container = styled.div`
background: #ffffff;
border-radius: 8px;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.06);
max-width: 360px;
padding: 16px;
`;
export const Image = styled.img`
border-radius: 8px;
object-fit: cover;
height: 240px;
width: 100%;
`;
export const Title = styled.p`
font-style: normal;
font-weight: 600;
font-size: 20px;
line-height: 100%;
`;
export const Content = styled.div``;
export const Footer = styled.div``;
export const Prices = styled.div`
display: flex;
flex-direction: column;
justify-content: flex-end;
`;
export const Price = styled.span`
&::before {
content: 'R$ ';
color: 'green';
font-weight: 600;
}
`;
export const Buttons = styled.div`
display: flex;
gap: 8px;
`;

0 comments on commit 1d75232

Please sign in to comment.