Skip to content

Commit e20b41b

Browse files
committed
Integrate gatsby-remark-prismjs and update markdown docs
1 parent eff3b21 commit e20b41b

File tree

12 files changed

+108
-41
lines changed

12 files changed

+108
-41
lines changed

markdowns/foundation/colors.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,63 @@ path: "/foundation/colors"
44
title: "Colors"
55
---
66

7-
#### rgba
7+
#### loadColors
8+
Load set of colors to use in the app.
9+
These colors will be accessible through the Colors class and as modifiers.
810
usage:
11+
```javascript
12+
import {Colors} from 'react-native-ui-lib';
13+
14+
Colors.loadColors({
15+
error: '#ff2442',
16+
success: '#00CD8B',
17+
text: '#20303C'
18+
});
19+
```
20+
21+
```jsx
22+
import {View, Text, Colors} from 'react-native-ui-lib';
23+
24+
<View>
25+
<Text style={{color: Colors.error}}>Error Message</Text>
26+
<Text success>Success Message</Text>
27+
<View>
28+
```
29+
30+
#### loadSchemes
31+
Load set of scheme colors to support dark/light mode.
32+
This features works hand in hand with our modifiers
33+
34+
```js
35+
Colors.loadSchemes({
36+
light: {
37+
screenBG: 'transparent',
38+
textColor: Colors.grey10,
39+
moonOrSun: Colors.yellow30,
40+
mountainForeground: Colors.green30,
41+
mountainBackground: Colors.green50
42+
},
43+
dark: {
44+
screenBG: Colors.grey10,
45+
textColor: Colors.white,
46+
moonOrSun: Colors.grey80,
47+
mountainForeground: Colors.violet10,
48+
mountainBackground: Colors.violet20
49+
}
50+
});
51+
```
52+
953
```jsx
54+
<View flex padding-page bg-screenBG>
55+
<Text h1 textColor>
56+
Dark Mode
57+
</Text>
58+
</View>
59+
```
60+
61+
#### rgba
62+
usage:
63+
```js
1064
import {Colors} from 'react-native-ui-lib';
1165

1266
Colors.rgba('#ff2442', 0.05); // 'rgb(255, 36, 66, 0.05)'
@@ -15,7 +69,7 @@ Colors.rgba(44, 224, 112, 0.2); // 'rgb(44, 224, 112, 0.2)'
1569

1670
#### getColorTint
1771
usage:
18-
```jsx
72+
```js
1973
import {Colors} from 'react-native-ui-lib';
2074

2175
Colors.getColorTint(Colors.green30, 70); // will return the value of Colors.green70

markdowns/foundation/modifiers.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Use our alignment props to quickly position your view's content without getting
2727

2828
! Notice that the layout modifiers affect the View's children
2929

30-
```
30+
```jsx
3131
<View flex left>
3232
<Button label="Button" />
3333
</View>
@@ -60,7 +60,7 @@ It's always important to use your margins and paddings correctly, with modifiers
6060
- paddingB-[value] - Bottom padding
6161
- paddingH-[value] - Horizontal padding
6262
- paddingV-[value] - Vertical padding
63-
```
63+
```jsx
6464
<View paddingV-20 paddingH-30>...</View>
6565
```
6666

@@ -72,12 +72,12 @@ It's always important to use your margins and paddings correctly, with modifiers
7272
- marginH-[value] - Horizontal margin
7373
- marginV-[value] - Vertical margin
7474

75-
```
75+
```jsx
7676
<View marginT-5 marginB-10>...</View>
7777
```
7878

7979
! padding and margin modifiers can also take [Spacing](https://github.com/wix/react-native-ui-lib/blob/master/src/style/spacings.ts) constants.
80-
```
80+
```jsx
8181
<View margin-s5 padding-s2>...</View>
8282
```
8383
## Position Modifiers
@@ -93,20 +93,20 @@ Last type of modifiers are for styling your components
9393
- [colorKey] - Controls text components' color
9494
- background-[colorKey] (or bg-[colorKey]) - Background color
9595

96-
```
96+
```jsx
9797
<Text blue30>...</Text>
9898
<View bg-dark70>...</View>
9999
<TouchableOpacity bg-red30/>
100100
```
101101

102102
- [typographyKey] - Controls text components' typography
103-
```
103+
```jsx
104104
<Text text70>...</Text>
105105
<TextInput text80/>
106106
```
107107

108108
- br[borderRadiusKey] - Set the view's border radius (e.g. `br10`, `br20`, .., `br60`)
109-
```
109+
```jsx
110110
<View br40>...</View>
111111
```
112112

markdowns/foundation/theme-manager.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The default value will be overridden if a prop is being passed to the component
1515

1616
Example
1717

18-
```
18+
```js
1919
import {ThemeManager} from 'react-native-ui-lib';
2020

2121
ThemeManager.setComponentTheme('Text', {
@@ -39,7 +39,7 @@ Same as `setComponentTheme` only it can't be overridden by props passed to the c
3939

4040
Example
4141

42-
```
42+
```js
4343
ThemeManager.setComponentForcedTheme('Card', (props, context) => {
4444
return {
4545
containerStyle: [styles.defaultContainerStyle, props.containerStyle]

markdowns/getting-started/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ If you're planning on using specific components, see **UILib Packages**.
3030
*For some packages you might still need to install one of the peer dependencies*
3131

3232
If you want it all, install **peer dependencies**
33-
```
33+
```js
3434
npm i react-native-gesture-handler react-native-reanimated @react-native-community/blur @react-native-community/datetimepicker @react-native-community/netinfo @react-native-picker/picker
3535

3636
cd ios && pod install

uilib-docs/configurations/plugins.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ const markdownPagesPlugin = (path = `${__dirname}/../../markdowns/`) => [
2323
path
2424
}
2525
},
26-
`gatsby-transformer-remark`
26+
{
27+
resolve: `gatsby-transformer-remark`,
28+
plugins: [
29+
{
30+
resolve: `gatsby-remark-prismjs`,
31+
options: {
32+
}
33+
}
34+
]
35+
}
36+
/* `gatsby-transformer-remark` */
2737
];
2838

2939
const componentsDocgenPlugin = [

uilib-docs/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "uilib-docs",
33
"description": "uilib docs template",
4-
"version": "1.0.14",
4+
"version": "1.0.15",
55
"author": "Ethan Sharabi <[email protected]>",
66
"main": "index.js",
77
"dependencies": {
@@ -15,12 +15,14 @@
1515
"gatsby-plugin-react-helmet": "^3.0.10",
1616
"gatsby-plugin-sass": "^2.0.11",
1717
"gatsby-plugin-sharp": "^2.0.29",
18+
"gatsby-remark-prismjs": "^4.1.0",
1819
"gatsby-source-filesystem": "^2.0.27",
1920
"gatsby-transformer-react-docgen": "^5.0.0",
20-
"gatsby-transformer-remark": "^2.8.3",
21+
"gatsby-transformer-remark": "^3.0.0",
2122
"gatsby-transformer-sharp": "^2.1.17",
2223
"lodash": "^4.17.11",
2324
"node-sass": "^4.11.0",
25+
"prismjs": "^1.22.0",
2426
"prop-types": "^15.7.2",
2527
"react": "^16.8.4",
2628
"react-dom": "^16.8.4",

uilib-docs/src/components/layout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Layout = ({children, location}) => {
4646
<meta property="twitter:title" content={metaTitle} />
4747
<meta property="twitter:description" content={metaDescription} />
4848
<link rel="canonical" href="https://wix.github.io/react-native-ui-lib/" />
49-
<script
49+
{/* <script
5050
src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.22.0/prism.min.js"
5151
integrity="sha512-9+422Bs3A87UkWfp+qV80Nfv9arhbCXKY1rxrF2seorI36mIIstMiuBfyKLF1yH1nnzQkEWq2xrzT4XU3Z+vrA=="
5252
crossorigin="anonymous"
@@ -56,7 +56,7 @@ const Layout = ({children, location}) => {
5656
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.22.0/themes/prism-tomorrow.min.css"
5757
integrity="sha512-vswe+cgvic/XBoF1OcM/TeJ2FW0OofqAVdCZiEYkd6dwGXthvkSFWOoGGJgS2CW70VK5dQM5Oh+7ne47s74VTg=="
5858
crossorigin="anonymous"
59-
/>
59+
/> */}
6060
</Helmet>
6161
<Header githubDomain={siteMetadata.github} />
6262
{/* <div className={`main ${!showSidebar ? 'fill' : ''}`}> */}

uilib-docs/src/pages/index.scss

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,21 @@
139139
background: $violet20;
140140
color: $white;
141141

142-
.code-examples {
143-
display: flex;
144-
align-items: flex-start;
145-
146-
code {
147-
display: inline-block;
148-
white-space: break-spaces;
149-
text-align: left;
150-
background: $dark10;
151-
padding: 10px;
152-
margin-right: 10px;
153-
font-size: $text40;
154-
line-height: 1.4;
155-
}
156-
}
142+
// .code-examples {
143+
// display: flex;
144+
// align-items: flex-start;
145+
146+
// code {
147+
// display: inline-block;
148+
// white-space: break-spaces;
149+
// text-align: left;
150+
// background: $dark10;
151+
// padding: 10px;
152+
// margin-right: 10px;
153+
// font-size: $text40;
154+
// line-height: 1.4;
155+
// }
156+
// }
157157
}
158158

159159
.components-section {

uilib-docs/src/pages/sections/CodeSection.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const Tab = ({headline, codeSnippet}) => {
5757
return (
5858
<div className="tab-page">
5959
<p>{headline}</p>
60-
<pre className="code">
60+
<pre>
6161
<code className="language-javascript">{codeSnippet}</code>
6262
</pre>
6363
</div>

uilib-docs/src/pages/sections/CodeSection.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
.code-section {
44
padding-bottom: 5%;
5+
display: flex;
6+
flex-direction: column;
7+
align-items: center;
58

69
.headline {
710
text-align: center;
@@ -13,7 +16,7 @@
1316
width: 80vw;
1417

1518
@include desktop {
16-
width: 35vw;
19+
width: 55vw;
1720
}
1821

1922
.view-docs-button {
@@ -52,8 +55,8 @@
5255
}
5356

5457
.tab-page {
55-
.code {
56-
background-color: $black;
58+
pre {
59+
background-color: $dark10;
5760
padding: 20px;
5861
width: 100%;
5962
}

uilib-docs/src/styles/global.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import url('https://fonts.googleapis.com/css?family=Montserrat:100,200,300,400,500,600,700,800,900&display=swap');
22
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');
3+
@import '~prismjs/themes/prism-tomorrow.css';
34
@import 'src/styles/constants';
45
@import 'src/styles/components';
56

@@ -12,7 +13,6 @@ body {
1213
font-family: Poppins, sans-serif;
1314
-webkit-font-smoothing: antialiased;
1415
font-size: 12px;
15-
1616
@include tablet {
1717
font-size: 14px;
1818
}

uilib-docs/src/templates/markdown.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,13 @@
2222
}
2323

2424
pre {
25-
background-color: $dark80;
25+
background-color: $dark10;
2626
border-radius: 4px;
2727
padding: 16px;
28-
box-shadow: 2px 2px 2px $dark60;
28+
box-shadow: 2px 2px 2px rgba($dark10, 0.2);
2929

3030
code {
3131
background: transparent;
32-
color: $dark10;
3332
padding: 0;
3433
white-space: pre-wrap;
3534
}
@@ -39,7 +38,6 @@
3938
word-break: break-word;
4039
display: inline-block;
4140
background: $dark70;
42-
color: $primary;
4341
padding: 1px 2px;
4442
margin-bottom: 2px;
4543
}

0 commit comments

Comments
 (0)