Skip to content

Commit c771600

Browse files
committed
More light mode stuff
1 parent daef566 commit c771600

File tree

27 files changed

+394
-241
lines changed

27 files changed

+394
-241
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "src/node_modules/@ractf/ui-kit"]
2-
path = src/node_modules/@ractf/ui-kit
2+
path = src/@ractf/ui-kit
33
url = https://github.com/ractf/ui-kit

jsconfig.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "src"
4+
},
5+
"include": ["src"]
6+
}

src/@ractf/ui-kit

Submodule ui-kit added at 1fadedc

src/@ractf/util/index.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { forwardRef, createElement } from "react";
2+
export { default as useReactRouter } from "./useReactRouter";
3+
export { default as useWindowSize } from "./useWindowSize";
4+
5+
export const TYPES = ["primary", "secondary", "success", "info", "warning", "danger", "light"];
6+
7+
export const makeClass = (...classes) => (
8+
classes.filter(x => !!x).join(" ")
9+
);
10+
11+
export const getHeight = (...children) => {
12+
let height = 0;
13+
children.forEach(child => {
14+
let styles = window.getComputedStyle(child);
15+
height += child.offsetHeight;
16+
height += parseFloat(styles['marginTop']);
17+
height += parseFloat(styles['marginBottom']);
18+
});
19+
return height;
20+
};
21+
22+
export const basicComponent = (localClass, element) => forwardRef(
23+
({ className, ...props }, ref) => createElement(element || "div", {
24+
className: makeClass(localClass, className),
25+
...props, ref: ref
26+
})
27+
);
28+
29+
export const propsToTypeClass = (props, styles, fallback) => {
30+
let className = "";
31+
for (const i of TYPES) {
32+
if (props[i]) {
33+
if (className.length) className += " ";
34+
className += styles[i];
35+
};
36+
}
37+
if (!className.length && fallback) className += styles[fallback];
38+
return className;
39+
};

src/components/SiteNav.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ export default ({ children }) => {
7171

7272
const header = <Wordmark />;
7373
const footer = <>
74-
<div className="sbtfCopy">
74+
<footer>
7575
<img alt={""} src={footerLogo} />
7676
&copy; Really Awesome Technology Ltd 2020
77-
</div>
77+
</footer>
7878
<Link to="/">
7979
{t("footer.home")}
8080
</Link> - <Link to="/privacy">

src/containers/controllers/API.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,8 @@ class APIClass extends Component {
526526
}
527527
};
528528

529-
modifyUser = (userId, data) => this.patch(BASE_URL + ENDPOINTS.USER + userId, data);
530-
modifyTeam = (teamId, data) => this.patch(BASE_URL + ENDPOINTS.TEAM + teamId, data);
529+
modifyUser = (userId, data) => this.patch(ENDPOINTS.USER + userId, data);
530+
modifyTeam = (teamId, data) => this.patch(ENDPOINTS.TEAM + teamId, data);
531531

532532
createTeam = (name, password) => {
533533
return new Promise((resolve, reject) => {

src/containers/controllers/App.scss

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ $link: (
1818
font-size: 100%;
1919
}
2020

21+
p {
22+
margin: 0;
23+
}
24+
2125
body {
2226
font-family: $fontStack;
2327
background-color: map-get($base, "background");
@@ -64,6 +68,7 @@ pre > code {
6468
a, .linkStyle {
6569
text-decoration: none;
6670
color: map-get($link, "color");
71+
cursor: pointer;
6772
margin: 0;
6873
padding: 0;
6974

@@ -261,9 +266,9 @@ b {
261266
border-radius: 2px;
262267
display: flex;
263268
align-items: center;
264-
background-color: $red_200;
269+
background-color: map-get($colours, "red");
265270
&.less {
266-
background-color: #f5954c;
271+
background-color: map-get($colours, "yellow");
267272
}
268273
color: $back_900;
269274
font-weight: 600;

src/containers/pages/Campaign.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,18 @@ const CategoryList = () => {
9393

9494
return <Page>
9595
<PageHead subTitle={t("categories.pick")} title={t("categories.all")} />
96-
{api.challenges.map(i => {
97-
let solved = i.challenges.filter(j => j.solved).length;
98-
99-
return <Leader key={i.id} link={"/campaign/" + i.id} green={solved === i.challenges.length}
100-
sub={solved === i.challenges.length ? t("categories.finished") :
101-
solved === 0 ? t("categories.none") :
102-
t("categories.some", { count: i.challenges.length, total: solved })}>
103-
{i.name}
104-
</Leader>;
105-
})}
96+
<Row>
97+
{api.challenges.map(i => {
98+
let solved = i.challenges.filter(j => j.solved).length;
99+
100+
return <Leader key={i.id} link={"/campaign/" + i.id} green={solved === i.challenges.length}
101+
sub={solved === i.challenges.length ? t("categories.finished") :
102+
solved === 0 ? t("categories.none") :
103+
t("categories.some", { count: i.challenges.length, total: solved })}>
104+
{i.name}
105+
</Leader>;
106+
})}
107+
</Row>
106108
</Page>;
107109
};
108110

src/containers/pages/Profile.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939
.teamMemberico {
4040
font-size: 0.9em;
41-
color: $fg;
41+
color: map-get($colours, "white");
4242

4343
svg {
4444
margin-bottom: -0.125em;
@@ -154,7 +154,7 @@
154154
}
155155
.userSolve {
156156
padding: 12px 16px;
157-
background-color: rgba($back_lift, 0.3);
157+
background-color: $back_lift;
158158
margin-bottom: 4px;
159159
width: 100%;
160160
text-align: left;

src/containers/pages/SettingsPage.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
44

55
import {
66
Page, HR, Row, TabbedView, Tab, Button, Form, FormError, Input,
7-
Checkbox, FormGroup
7+
Checkbox, FormGroup, InputButton
88
} from "@ractf/ui-kit";
99
import { apiContext, appContext, apiEndpoints, zxcvbn, localConfig } from "ractf";
1010

@@ -79,6 +79,7 @@ export default () => {
7979
};
8080

8181
const changeUsername = ({ name }) => {
82+
console.log(name);
8283
if (!name)
8384
return setUnError(t("settings.uname_required"));
8485
if (name === api.user.username)
@@ -144,14 +145,10 @@ export default () => {
144145

145146
<Form handle={changeUsername}>
146147
<FormGroup htmlFor={"name"} label={t("username")}>
147-
<Input name={"name"} val={api.user.username} limit={36}
148-
placeholder={t("username")} />
148+
<InputButton name={"name"} label={t("username")} val={api.user.username}
149+
limit={36} placeholder={t("username")} button={t("save")} submit />
149150
</FormGroup>
150-
151151
{unError && <FormError>{unError}</FormError>}
152-
<Row>
153-
<Button submit>{t("save")}</Button>
154-
</Row>
155152
</Form>
156153
<HR />
157154
<Form handle={changePassword}>

0 commit comments

Comments
 (0)