forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_shuffleWords.js
More file actions
53 lines (47 loc) · 1 KB
/
_shuffleWords.js
File metadata and controls
53 lines (47 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from 'react';
import TextLoop from 'react-text-loop';
import styled from 'styled-components';
const ShuffleWords = styled.section`
color: ${props => props.theme.homepage.white};
font-size: 2em;
font-family: 'dank mono', 'dm', monospace;
text-align: center;
margin-top: 2rem;
margin-bottom: 6rem;
text-align: center;
@media screen and (max-width: 900px) {
font-size: 1.5rem;
}
@media screen and (max-width: 700px) {
font-size: 1.2rem;
}
`;
const shuffle = a => {
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
};
const words = [
'State',
'Effect',
'Ref',
'Context',
'Reducer',
'Memo',
'Callback',
'ImperativeHandle',
'LayoutEffect',
'DebugValue',
];
export default () => (
<ShuffleWords>
import {'{ '}
use
<TextLoop interval={1500}>{shuffle(words).map(word => word)}</TextLoop>{' '}
{' }'} from {"'"}
react
{"'"}
</ShuffleWords>
);