Skip to content

Commit 55e7de7

Browse files
authored
docs: add layouts (@fehmer) (#6461)
1 parent 8bec7da commit 55e7de7

File tree

5 files changed

+93
-16
lines changed

5 files changed

+93
-16
lines changed

docs/CONTRIBUTING.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [Theme Guidelines](#theme-guidelines)
99
- [Language Guidelines](#language-guidelines)
1010
- [Quote Guidelines](#quote-guidelines)
11+
- [Layout Guidelines](#layout-guidelines)
1112
- [Questions](#questions)
1213

1314
## Getting Started
@@ -54,7 +55,7 @@ Before submitting a theme make sure...
5455
- your theme has been added to the `_list` file and the `textColor` property is the theme's main color
5556
- your theme is clear and readable with both `flip test colors` and `colorful mode` enabled and disabled
5657

57-
(If you want to contribute themes but don't know how, check [THEMES.md](./THEMES.md))
58+
If you want to contribute themes but don't know how, check [THEMES.md](./THEMES.md)
5859

5960
### Language Guidelines
6061

@@ -63,7 +64,7 @@ Before submitting a theme make sure...
6364
- Be sure to add your language to the `_list` and `_groups` files
6465
- Make sure the number of words in the file corresponds to the file name (for example: `languageName.json` is 200 words, `languageName_1k.json` is 1000 words, and so on)
6566

66-
(If you want to contribute languages but don't know how, check [LANGUAGES.md](./LANGUAGES.md))
67+
If you want to contribute languages but don't know how, check [LANGUAGES.md](./LANGUAGES.md)
6768

6869
### Quote Guidelines
6970

@@ -77,7 +78,11 @@ Before submitting a theme make sure...
7778
- Remember to name your pull request properly. For example, if you are adding new quotes for the language `French`, your pull request should be named `impr(quotes): add French quotes`.
7879

7980

80-
(If you want to contribute quotes but don't know how, check [QUOTES.md](./QUOTES.md))
81+
If you want to contribute quotes but don't know how, check [QUOTES.md](./QUOTES.md)
82+
83+
### Layout Guidelines
84+
85+
If you want to contribute layouts but don't know how, check [LAYOUTS.md](./LAYOUTS.md)
8186

8287
## Questions
8388

docs/LANGUAGES.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Once you have forked the repository you can now add your language. Create a new
1717

1818
The contents of the file should be as follows:
1919

20-
```
20+
```json
2121
{
2222
"name": string,
2323
"rightToLeft": boolean,
@@ -33,7 +33,7 @@ It is recommended that you familiarize yourselves with JSON before adding a lang
3333

3434
In addition to the language file, you need to add your language to the `_groups.json` and `_list.json` files in the same directory. Add the name of the language to the `_groups.json` file like so:
3535

36-
```
36+
```json
3737
{
3838
"name": "spanish",
3939
"languages": ["spanish", "spanish_1k", "spanish_10k"]
@@ -52,7 +52,7 @@ The `languages` field is the list of files that you have created for your langua
5252

5353
Add your language lists to the `_list.json` file like so:
5454

55-
```
55+
```json
5656
,"spanish"
5757
,"spanish_1k"
5858
,"spanish_10k"
@@ -74,5 +74,5 @@ Create a pull request:
7474

7575
## Language Guidelines
7676

77-
Make sure your language follows the language guidelines.
78-
[Language guidelines](./CONTRIBUTING.md#language-guidelines)
77+
Make sure your language follows the [Language guidelines](./CONTRIBUTING.md#language-guidelines).
78+

docs/LAYOUTS.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
### **Table of Contents**
2+
3+
- [Forking Monkeytype](#forking-monkeytype)
4+
- [Creating Layouts](#creating-layouts )
5+
- [Committing Layouts](#committing-layouts)
6+
7+
### Forking Monkeytype
8+
9+
First, you will have to make a personal copy of the Monkeytype repository, also known as "forking". Go to the [Monkeytype repo](https://github.com/monkeytypegame/monkeytype/) and then click the "fork" button.
10+
11+
<img width="1552" alt="Screenshot showing location of the fork button on GitHub." src="https://user-images.githubusercontent.com/83455454/149194972-23343642-7a1f-4c0c-b5f2-36f4b39a2639.png">
12+
13+
## Creating Layouts
14+
15+
Once you have forked the repository you can now add your layout. Create a new JSON file in `./frontend/static/layouts/`, named as the layout name, e.g. `qwerty.json`.
16+
17+
The contents of the file should be as follows:
18+
19+
```json
20+
{
21+
"keymapShowTopRow": false,
22+
"type": "ansi",
23+
"keys": {
24+
"row1": ["`~", "1!", "2@", "3#", "4$", "5%", "6^", "7&", "8*", "9(", "0)", "-_", "=+"],
25+
"row2": ["qQ", "wW", "eE", "rR", "tT", "yY", "uU", "iI", "oO", "pP", "[{", "]}", "\\|"],
26+
"row3": ["aA", "sS", "dD", "fF", "gG", "hH", "jJ", "kK", "lL", ";:", "'\""],
27+
"row4": ["zZ", "xX", "cC", "vV", "bB", "nN", "mM", ",<", ".>", "/?"],
28+
"row5": [" "]
29+
}
30+
}
31+
32+
```
33+
34+
It is recommended that you familiarize yourselves with JSON before adding a layout.
35+
36+
`keymapShowTopRow` indicates whether to always show the first row of the layout.
37+
`type` can be `ansi` or `iso`.
38+
39+
In `keys` you need to specify `row1` to `row5`. Add the keys within the row as string. The string can have up to four character. The character define unshifted, shifted, alt-gr and shifted alt-gr character in this order. For example `eE€` defines `e` on regular key press, `E` if `shift` is held and `` if `alt-gr` is held.
40+
41+
**Note:** Quote and backslash characters need to be escaped: `\"` and `\\`.
42+
43+
For ansi layouts the number of keys need to be exactly thirteen for `row1` and `row2`, eleven for `row3`, ten for `row4` and one or two for `row5`.
44+
45+
For iso the number of keys need to be exactly thirteen for `row1`, twelve for `row2` and `row3`, eleven for `row4` and one or two for `row5`.
46+
47+
48+
49+
In addition to the layout file you need to add your layout to the `frontend/src/ts/constants/layouts.ts` file. Just append your layout name (without the `.json`) at the __end__ of the array. Remember to add a comma like this:
50+
51+
```ts
52+
"ergopti",
53+
"sword",
54+
"YOUR_LAYOUT",
55+
];
56+
```
57+
58+
### Committing Layouts
59+
60+
Once you have created your layout, you now need to create a pull request to the main Monkeytype repository. Go to the branch where you created your layout on GitHub. Then make sure your branch is up to date. Once it is up to date, click "contribute".
61+
62+
Update branch:
63+
<img width="1552" alt="Screenshot showing how to update the fork to match the main Monkeytype repository" src="https://user-images.githubusercontent.com/83455454/149186547-5b9fe4fd-b944-4eed-a959-db43f96198bf.png">
64+
65+
Create a pull request:
66+
<img width="1552" alt="Screenshot showing how to create a pull request to the main Monkeytype repository" src="https://user-images.githubusercontent.com/83455454/149186637-66dae488-05ae-45c4-9217-65bc36c4927b.png">
67+
68+
Make sure your PR title follow the syntax `feat(layout): add <YOUR_LAYOUT> layout (@<YOUR_GITHUB_NAME>)`, e.g. `feat(layout): add qwerty layout (@teddinotteddy)`
69+
70+
## Layout Guidelines
71+
72+
Make sure your layout follows the [Layout guidelines](./CONTRIBUTING.md#layout-guidelines).

docs/QUOTES.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ First you will have to copy the Monkeytype repository also known as forking. Go
1515

1616
After you forked the Monkeytype repository you can now add your quotes. (If you haven't already forked the repository, refer to this [section](#forking-monkeytype).) (Before continuing to the next step make sure the quote's language exists in Monkeytype) Add this code in at the end of the quotes `./frontend/static/quotes/[language].json`:
1717

18-
```
18+
```json
1919
{
2020
"text": "[quote]",
2121
"source": "[source]",
@@ -24,7 +24,7 @@ After you forked the Monkeytype repository you can now add your quotes. (If you
2424
}
2525
```
2626

27-
(If the language does exist in Monkeytype, but there are no quotes for it create a new file for the language)
27+
If the language does exist in Monkeytype, but there are no quotes for it create a new file for the language.
2828

2929
### Committing Quotes
3030

@@ -38,5 +38,5 @@ Create a pull request:
3838

3939
## Quote Guidelines
4040

41-
Make sure your quote(s) follows the quote guidelines.
42-
[Quote guidelines](./CONTRIBUTING.md#quote-guidelines)
41+
Make sure your quote(s) follows the [Quote guidelines](./CONTRIBUTING.md#quote-guidelines).
42+

docs/THEMES.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ After you have forked the repository you can now add your theme. Create a CSS fi
1818

1919
Then add this code to your file:
2020

21-
```
21+
```css
2222
:root {
2323
--bg-color: #ffffff;
2424
--main-color: #ffffff;
@@ -38,7 +38,7 @@ Here is an image showing what all the properties correspond to:
3838

3939
Change the corresponding hex codes to create your theme. Then, go to `./frontend/static/themes/_list.json` and add the following code to the very end of the file (inside the square brackets):
4040

41-
```
41+
```json
4242
{
4343
"name": "theme_name",
4444
"bgColor": "#ffffff",
@@ -64,5 +64,5 @@ Add some screenshots of your theme to the pull request. Click "create pull reque
6464

6565
## Theme Guidelines
6666

67-
Make sure your theme follows the theme guidelines.
68-
[Theme guidelines](./CONTRIBUTING.md#theme-guidelines)
67+
Make sure your theme follows the [Theme guidelines](./CONTRIBUTING.md#theme-guidelines).
68+

0 commit comments

Comments
 (0)