Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added card component #59

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import light from './styles/themes/light';
import dark from './styles/themes/dark';
import Header from './components/Header';
import Content from './components/Content';
import Card from './components/Card';

const App: React.FC = () => {
const [theme, setTheme] = usePersistedState<DefaultTheme>(
Expand All @@ -35,7 +36,9 @@ const App: React.FC = () => {
<LanguageSelector />
</Header>
<Content>
<Translator path="home.message" />
<Card title="home.message">
<Translator path="home.message" />
</Card>
</Content>
<GlobalStyle />
</ThemeProvider>
Expand Down
21 changes: 21 additions & 0 deletions src/app/components/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import Translator from '../I18n/Translator';

import { Container } from './styles';

interface Props {
title?: string;
}

const Card: React.FC<Props> = ({children, title}) => {
return (
<Container>
{title && (<h2>{<Translator path={title} />}</h2>)}
<div>
{children}
</div>
</Container>
);
};

export default Card;
20 changes: 20 additions & 0 deletions src/app/components/Card/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import styled from 'styled-components';

export const Container = styled.div`
background: ${(props) => props.theme.colors.card.background};
border-radius: 8px;
display: flex;
flex: 0 0 100%;
flex-direction: column;
margin: 16px 0 16px 0;

h2 {
padding: 32px 32px 16px 32px;
size: 24px;
}

& > div {
padding: 16px 32px 16px 32px;
margin: 0 0 16px 0;
}
`;
4 changes: 4 additions & 0 deletions src/app/styles/styled.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ declare module 'styled-components' {
header: {
background: string;
}

card: {
background: string;
}
}
}
}
4 changes: 4 additions & 0 deletions src/app/styles/themes/dark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default {

header: {
background: '#34343D',
},

card: {
background: '#34343D',
}
}
};
4 changes: 4 additions & 0 deletions src/app/styles/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export default {

header: {
background: '#E7E7EE',
},

card: {
background: '#E7E7EE',
}
}
};