Skip to content

Commit ab2f8a3

Browse files
committed
feat(background): adds a basic background component to wrap your app and screens in
1 parent af5074a commit ab2f8a3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/components/Background.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react";
2+
import "./css/main.css";
3+
import styled from "styled-components";
4+
import { getThemeValue } from "./ThemeProvider";
5+
6+
export const Background = (props: { children: React.ReactNode }) => {
7+
const { children } = props;
8+
return <StyledBackground>{children}</StyledBackground>;
9+
};
10+
11+
const StyledBackground = styled.div`
12+
background-color: ${(props) =>
13+
props.theme.background ?? getThemeValue("background")};
14+
color: ${(props) => props.theme.text ?? getThemeValue("text")};
15+
min-height: 100vh;
16+
display: flex;
17+
flex-direction: column;
18+
align-items: center;
19+
justify-content: flex-start;
20+
`;

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// MARK: Component imports
22

33
export { Button, type ButtonProps } from './components/Button';
4+
export { Background } from './components/Background';
45
export { TextField, type TextFieldProps } from './components/TextField';
56
export { Text, type TextProps } from './components/Text';
67
export { ThemeProvider } from './components/ThemeProvider';

0 commit comments

Comments
 (0)