Skip to content

Commit 51ded97

Browse files
committed
feat: add theme
1 parent de5132c commit 51ded97

File tree

9 files changed

+72
-13
lines changed

9 files changed

+72
-13
lines changed

components/auth/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/// <reference path="../../types/styled.d.ts" />
2+
13
export { AuthPage } from "./src/AuthPage";
24

35
import { H1 } from "@revolt/ui";

components/auth/src/AuthPage.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Route, Routes } from "@solidjs/router";
2-
import { css, styled } from "solid-styled-components";
2+
import { styled } from "solid-styled-components";
33
import { LocaleSelector, useTranslation } from "@revolt/i18n";
44

55
import { BiLogosGithub, BiLogosTwitter, BiLogosMastodon } from "solid-icons/bi";
@@ -32,11 +32,10 @@ const Base = styled("div")`
3232
flex-direction: column;
3333
justify-content: space-between;
3434
35-
/* TODO breakpoint md */
36-
@media (max-width: 768px) {
35+
@media (max-width: ${({ theme }) => theme!.breakpoints.md}) {
3736
padding: 30px 20px;
3837
background-image: unset;
39-
background-color: #242424;
38+
background-color: ${({ theme }) => theme!.colours["background-200"]};
4039
/* TODO primary bg */
4140
}
4241
`;
@@ -68,11 +67,11 @@ const NavItems = styled("div")<{
6867
color: #ddd;
6968
font-size: 0.9em;
7069
71-
@media (max-width: 768px) {
70+
@media (max-width: ${({ theme }) => theme!.breakpoints.md}) {
7271
display: ${(props) => (props.hide ? "none" : "flex")};
7372
}
7473
75-
@media (max-width: 768px) {
74+
@media (max-width: ${({ theme }) => theme!.breakpoints.md}) {
7675
flex-direction: ${(props) => (props.stack ? "column" : "row")};
7776
}
7877
`;
@@ -86,7 +85,7 @@ const Bullet = styled("div")`
8685
background: grey;
8786
border-radius: 50%;
8887
89-
@media (max-width: 768px) {
88+
@media (max-width: ${({ theme }) => theme!.breakpoints.md}) {
9089
display: none;
9190
}
9291
`;

components/auth/types

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../types

components/ui/components/design/atoms/heading/H1.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export const H1 = styled("h1")`
66
77
font-weight: 600;
88
font-size: 1.2rem;
9-
color: var(--foreground);
9+
color: ${({ theme }) => theme!.colours.foreground};
1010
`;

components/ui/components/design/atoms/inputs/ComboBox.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ export const ComboBox = styled("select")`
77
font-family: inherit;
88
font-weight: 500;
99
10-
color: var(--foreground);
11-
background: var(--secondary-background);
10+
color: ${({ theme }) => theme!.colours.foreground};
11+
background: ${({ theme }) => theme!.colours["background-100"]};
1212
1313
border: none;
14-
border-radius: var(--border-radius);
14+
border-radius: ${({ theme }) => theme!.borderRadius.md};
1515
box-sizing: border-box;
16+
1617
outline: none;
1718
cursor: pointer;
1819

components/ui/index.tsx

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
export * from "./components/design/atoms/heading";
22
export * from "./components/design/atoms/inputs";
33

4+
import type { DefaultTheme } from "solid-styled-components";
45
export { ThemeProvider } from "solid-styled-components";
56

6-
export const darkTheme = {};
7+
export const darkTheme: DefaultTheme = {
8+
colours: {
9+
accent: "#FD6671",
10+
foreground: "#FFF",
11+
"foreground-100": "#EEE",
12+
"foreground-200": "#CCC",
13+
"foreground-300": "#AAA",
14+
"foreground-400": "#848484",
15+
background: "#000",
16+
"background-100": "#1E1E1E",
17+
"background-200": "#242424",
18+
"background-300": "#363636",
19+
"background-400": "#4D4D4D",
20+
"status-online": "#3ABF7E",
21+
"status-idle": "#F39F00",
22+
"status-focus": "#4799F0",
23+
"status-busy": "#F84848",
24+
"status-streaming": "#977EFF",
25+
"status-offline": "#A5A5A5",
26+
},
27+
breakpoints: {
28+
sm: "640px",
29+
md: "768px",
30+
lg: "1024px",
31+
xl: "1280px",
32+
},
33+
borderRadius: {
34+
md: "6px",
35+
lg: "12px",
36+
},
37+
};

components/ui/types

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../types

packages/client/src/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { render } from "solid-js/web";
33

44
import "./styles.css";
55

6+
import { ThemeProvider, darkTheme } from "@revolt/ui";
67
import i18n, { I18nContext } from "@revolt/i18n";
78
import { Router } from "@solidjs/router";
89
import App from "./App";
@@ -11,7 +12,9 @@ render(
1112
() => (
1213
<Router>
1314
<I18nContext.Provider value={i18n}>
14-
<App />
15+
<ThemeProvider theme={darkTheme}>
16+
<App />
17+
</ThemeProvider>
1518
</I18nContext.Provider>
1619
</Router>
1720
),

types/styled.d.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import "solid-styled-components";
2+
3+
declare module "solid-styled-components" {
4+
export interface DefaultTheme {
5+
colours: {
6+
[key in
7+
| 'accent'
8+
| 'foreground'
9+
| `foreground-${100 | 200 | 300 | 400}`
10+
| 'background'
11+
| `background-${100 | 200 | 300 | 400}`
12+
| `status-${'online' | 'idle' | 'focus' | 'busy' | 'streaming' | 'offline'}`]: string;
13+
};
14+
breakpoints: {
15+
[key in 'sm' | 'md' | 'lg' | 'xl']: string;
16+
};
17+
borderRadius: {
18+
[key in 'md' | 'lg']: string;
19+
};
20+
}
21+
}

0 commit comments

Comments
 (0)