Skip to content

Commit 33dcd23

Browse files
committed
init: repo
0 parents  commit 33dcd23

File tree

125 files changed

+12948
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+12948
-0
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!src
3+
!pages
4+
!yarn.lock
5+
!package.json

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[{package.json,*.yml}]
12+
indent_style = space
13+
indent_size = 2

.eslintrc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "airbnb",
4+
"rules": {
5+
"react/react-in-jsx-scope": 0,
6+
"react/prop-types": 0,
7+
"react/jsx-filename-extension": 0,
8+
"jsx-a11y/anchor-is-valid": 0
9+
}
10+
}

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.next
2+
node_modules
3+
.DS_Store
4+
.vscode
5+
out
6+
yarn-error.log
7+
bundles

.yarnrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-prefix ""

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mhart/alpine-node:10
2+
# We store all our files in /usr/src to perform the build
3+
WORKDIR /usr/src
4+
# We first add only the files required for installing deps
5+
# If package.json or yarn.lock don't change, no need to re-install later
6+
COPY package.json yarn.lock ./
7+
# We install our deps
8+
RUN yarn
9+
# We copy all source files
10+
COPY . .
11+
# We run the build and expose as /public
12+
RUN yarn build && yarn export -o /public

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Rehooks website
2+
3+
The official website for [Rehooks](https://rehooks.com)
4+
5+
## Contribution
6+
7+
If you need to make any changes to the website:
8+
9+
1. Clone this repo
10+
2. Run `yarn` to install dependencies
11+
3. Run `yarn dev` to start the server on `http://localhost:3000`

components/background-slider.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export default ({ duration, children }) => (
2+
<div className="slider-container">
3+
<style jsx>{`
4+
.slider-container {
5+
overflow: hidden;
6+
white-space: nowrap;
7+
}
8+
.slider-content-wrapper {
9+
display: inline-block;
10+
white-space: nowrap;
11+
overflow: hidden;
12+
animation: slide ${duration * 2 || 10}s linear infinite;
13+
}
14+
.slider-content-wrapper > div {
15+
display: inline-block;
16+
}
17+
@keyframes slide {
18+
from {
19+
transform: translate3d(0, 0, 0);
20+
}
21+
to {
22+
transform: translate3d(-50%, 0, 0);
23+
}
24+
}
25+
`}</style>
26+
<div className="slider-content-wrapper">
27+
<div>{children}</div>
28+
<div>{children}</div>
29+
</div>
30+
</div>
31+
);

components/button.js

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import Link from 'next/link'
2+
import classNames from 'classnames'
3+
4+
import withPure from './hoc/pure'
5+
6+
export default withPure(
7+
({ children, invert, href, as, className, prefetch, ...props }) => {
8+
const a = (
9+
<a
10+
className={classNames(className, 'fw4 no-drag', { invert })}
11+
role="button"
12+
{...props}
13+
>
14+
{children}
15+
<style jsx>
16+
{`
17+
a {
18+
display: inline-block;
19+
cursor: pointer;
20+
text-decoration: none;
21+
padding: 0.25rem 0.5rem;
22+
margin: -0.25rem -0.5rem;
23+
border-radius: 7px;
24+
color: #0076ff;
25+
transition: background 0.2s ease, color 0.2s ease,
26+
box-shadow 0.2s ease;
27+
}
28+
a:hover {
29+
color: #0076ff;
30+
background: rgba(0, 118, 255, 0.1);
31+
}
32+
a.invert {
33+
margin: 0;
34+
padding: 0 2rem;
35+
height: 2.5rem;
36+
line-height: 2.5rem;
37+
border-radius: 7px;
38+
background: #000;
39+
box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.39);
40+
color: white;
41+
}
42+
a.invert:hover {
43+
background: #272727;
44+
box-shadow: 0 6px 20px 0 rgba(50, 50, 50, 0.23);
45+
}
46+
a.invert:active {
47+
background: #484848;
48+
}
49+
`}
50+
</style>
51+
</a>
52+
)
53+
54+
if (href) {
55+
return (
56+
<Link href={href} as={as} prefetch={prefetch}>
57+
{a}
58+
</Link>
59+
)
60+
}
61+
return a
62+
}
63+
)

components/container.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
export default ({
2+
center,
3+
vCenter,
4+
dark,
5+
gray,
6+
wide,
7+
small,
8+
padding,
9+
overflow,
10+
minHeight,
11+
dotBackground,
12+
children,
13+
mobileStyle,
14+
...props
15+
}) => (
16+
<div {...props}>
17+
<style jsx>
18+
{`
19+
{
20+
width: 100%;
21+
margin: 0 auto;
22+
padding: ${padding ? '4rem' : '0'} ${wide ? '0' : '1rem'};
23+
${wide && !small ? '' : 'max-width: 1024px;'}
24+
${small ? 'max-width: 682px;' : ''}
25+
${center ? 'text-align: center;' : ''}
26+
${
27+
dark
28+
? 'background-image: linear-gradient(to bottom, #121212 0%, #323232 100%);'
29+
: ''
30+
}
31+
${dark ? 'color: #f1f1f1;' : ''}
32+
${gray ? 'background-color: #f6f6f6;' : ''}
33+
${wide && !overflow ? 'overflow: hidden;' : ''}
34+
${minHeight ? `min-height: ${minHeight}px;` : ''}
35+
${vCenter ? 'display: flex; align-items: center;' : ''}
36+
}
37+
:after {
38+
// BFC
39+
content: '';
40+
display: table;
41+
clear: both;
42+
}
43+
44+
// CSS only media query for tablet
45+
@media screen and (max-width: 960px) {
46+
div {
47+
padding: ${padding ? '4rem' : '0'} ${wide ? '0' : '2rem'};
48+
}
49+
}
50+
// CSS only media query for mobile
51+
@media screen and (max-width: 640px) {
52+
div {
53+
padding: ${padding ? '4rem' : '0'} ${wide ? '0' : '1rem'};
54+
${mobileStyle || ''}
55+
}
56+
}
57+
`}
58+
</style>
59+
{children}
60+
</div>
61+
)

components/css-config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const FONT_FAMILY_SANS =
2+
'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif'
3+
4+
export const FONT_FAMILY_MONO =
5+
'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif'
6+
7+
export const COLOR_ERROR = '#FF001F'
8+
export const COLOR_SUCCESS = '#067DF7'
9+
10+
export const COLOR_CODE_LIGHT = '#000000'

components/docs/docs.mdx

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
## Getting Started
2+
3+
### Setup
4+
5+
First, you need to install **React v16.7 or higher**:
6+
7+
```bash
8+
npm install --save react@^16.7.0-alpha.0 react-dom@^16.7.0-alpha.0
9+
```
10+
11+
Or with yarn:
12+
13+
```bash
14+
yarn add react@^16.7.0-alpha.0 react-dom@^16.7.0-alpha.0
15+
```
16+
17+
Now you can start writing `useState` and `useEffect` in your code. Here's a simple counter example:
18+
19+
```jsx
20+
import { useState } from 'react'
21+
22+
function Example() {
23+
const [count, setCount] = useState(0)
24+
25+
return (
26+
<div>
27+
<p>You clicked {count} times</p>
28+
<button onClick={() => setCount(count + 1)}>
29+
Click me
30+
</button>
31+
</div>
32+
)
33+
}
34+
```
35+
36+
Alternatively, this is class-based equivalent:
37+
38+
```jsx
39+
class Example extends React.Component {
40+
constructor(props) {
41+
super(props)
42+
this.state = {
43+
count: 0
44+
}
45+
}
46+
47+
onClick = () => {
48+
this.setState({
49+
count: this.state.count + 1
50+
})
51+
}
52+
53+
render() {
54+
return (
55+
<div>
56+
<p>You clicked {this.state.count} times</p>
57+
<button onClick={this.onClick}>
58+
Click me
59+
</button>
60+
</div>
61+
)
62+
}
63+
}
64+
```
65+
66+
### Controlled Inputs
67+
68+
First install `@rehooks/input-value`:
69+
70+
```
71+
yarn add @rehooks/input-value
72+
```
73+
74+
Then apply `useInputValue` in your component:
75+
76+
```jsx
77+
import useInputValue from '@rehooks/input-value';
78+
79+
function MyComponent() {
80+
let name = useInputValue('Jamie');
81+
// name = { value: 'Jamie', onChange: [Function] }
82+
return <input {...name}/>;
83+
}
84+
```
85+
86+
## FAQ
87+
88+
### What are React Hooks?
89+
90+
React Hooks allow you to use React concepts like state, context and methods without writing a class.
91+
92+
### What are Rehooks?
93+
94+
Rehooks are packages that make it easy to use Hooks in your existing application. Kinda like lodash for React Hooks.
95+
96+
## Contributing
97+
98+
Please check out the [rehooks/ideas repo](https://github.com/rehooks/ideas) or if you already know a Hook you want to build, check out the [rehooks/template repo](https://github.com/rehooks/template)
99+
100+
## Edit this page
101+
102+
You can find the repo for this website at [rehooks/website](http://github.com/rehooks/website)

0 commit comments

Comments
 (0)