Skip to content

Commit 3e68911

Browse files
committed
Tweaks and load theme form function
1 parent 423f9b6 commit 3e68911

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

Diff for: .prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"bracketSpacing": true,
66
"jsxBracketSameLine": false,
77
"arrowParens": "avoid",
8-
"printWidth": 120
8+
"printWidth": 100
99
}

Diff for: components/Form.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ export default function Form({ formID }) {
2020
font: "serif",
2121
};
2222

23-
// const theme = {
24-
// colorTheme: "dark",
25-
// };
26-
2723
if (isLoading) {
2824
return (
2925
<Wrapper>
@@ -44,7 +40,7 @@ export default function Form({ formID }) {
4440
}
4541

4642
return (
47-
<ThemeProvider theme={theme}>
43+
<ThemeProvider theme={formData.theme}>
4844
<Wrapper>
4945
<Navbar />
5046

Diff for: components/Tag.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import styled from "styled-components";
2+
import { getTagBackground, getTextColor } from "./styles/themeValues";
23

34
const Tag = styled.p`
45
display: inline-block;
5-
background: ${props => (props.theme.colorTheme == "dark" ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)")};
6-
color: ${props => (props.theme.colorTheme == "dark" ? "white" : "black")};
6+
background: ${props => getTagBackground(props)};
7+
color: ${props => getTextColor(props)};
78
padding: 2px 6px;
89
border-radius: 4px;
910
`;

Diff for: components/styles/themeValues.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,21 @@ function getInputColors(props) {
6262
}
6363
}
6464

65-
export { getTextColor, getBackgroundColor, getBorderColor, getFontFamily, getBoldFontWeight, getInputColors };
65+
function getTagBackground({ theme: { colorTheme } }) {
66+
switch (colorTheme) {
67+
case "light":
68+
return "rgba(0, 0, 0, 0.1)";
69+
case "dark":
70+
return "rgba(255, 255, 255, 0.1)";
71+
}
72+
}
73+
74+
export {
75+
getTextColor,
76+
getBackgroundColor,
77+
getBorderColor,
78+
getFontFamily,
79+
getBoldFontWeight,
80+
getInputColors,
81+
getTagBackground,
82+
};

0 commit comments

Comments
 (0)