Skip to content

Commit 44b4724

Browse files
docs(website): add introduction video
1 parent db94d5d commit 44b4724

File tree

5 files changed

+43
-28
lines changed

5 files changed

+43
-28
lines changed

packages/overmind-website/src/components/VideoPlayer/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ type Props = {
66
url: string
77
}
88

9-
// https://www.youtube.com/watch?v=RA1_cCgEWws
10-
11-
const VideoPlayer: SFC<Props> = () => {
9+
const VideoPlayer: SFC<Props> = ({ url }) => {
1210
const ref = useRef(null)
1311
const isMobile = useIsMobile()
1412

@@ -25,10 +23,7 @@ const VideoPlayer: SFC<Props> = () => {
2523
className={styles.iframe}
2624
width={isMobile ? '300' : '560'}
2725
height={isMobile ? '169' : '315'}
28-
src={
29-
this.props.url.replace('watch?v=', 'embed/') +
30-
'?rel=0&amp;showinfo=0'
31-
}
26+
src={url.replace('watch?v=', 'embed/') + '?rel=0&amp;showinfo=0'}
3227
frameBorder="0"
3328
// @ts-ignore
3429
allow="autoplay; encrypted-media"

packages/overmind-website/src/components/Videos/styles.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ export const video = css`
1414
position: relative;
1515
display: flex;
1616
align-items: center;
17-
text-decoration: none;
1817
justify-content: center;
1918
text-align: center;
2019
box-sizing: border-box;
21-
padding: var(--padding-3);
22-
color: var(--color-white-1);
20+
text-decoration: none;
21+
padding: var(--padding-4);
22+
margin: var(--padding-3);
23+
color: var(--color-black-1);
2324
font-size: var(--font-size-4);
2425
cursor: pointer;
2526
width: 200px;
2627
height: 125px;
27-
background-color: var(--color-black-2);
28+
border-bottom: 2px solid var(--color-primary);
2829
transition: box-shadow 0.1s ease-out;
2930
box-shadow: 0px 0px 20px -10px rgba(0, 0, 0, 0.75);
3031
:hover {
@@ -35,6 +36,6 @@ export const video = css`
3536
bottom: var(--padding-2);
3637
right: var(--padding-2);
3738
font-size: var(--font-size-1);
38-
color: var(--color-white-2);
39+
color: var(--color-black-2);
3940
}
4041
`

packages/overmind-website/src/overmind/actions.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Action, fromOperator, pipe, action, filter, debounce } from 'overmind'
22
import { Page, RouteContext, GuideParams, VideoParams } from './types'
3+
import * as operators from './operators'
34

45
export const openHome: Action<RouteContext> = async ({ state, effects }) => {
56
state.page = Page.HOME
@@ -17,22 +18,13 @@ export const openGuides: Action<RouteContext> = async ({ state, effects }) => {
1718
}
1819
}
1920

20-
export const openVideos: Action<RouteContext> = async ({ state, effects }) => {
21-
state.page = Page.VIDEOS
22-
if (!state.videos.length) {
23-
state.isLoadingVideos = true
24-
state.videos = await effects.request('/backend/videos')
25-
state.isLoadingVideos = false
26-
}
27-
}
21+
export const openVideos: Action<RouteContext> = fromOperator(
22+
operators.openVideos<RouteContext>()
23+
)
2824

29-
export const openVideo: Action<RouteContext<VideoParams>> = async ({
30-
value: routeContext,
31-
state,
32-
}) => {
33-
state.page = Page.VIDEOS
34-
state.currentVideo = routeContext.params.title
35-
}
25+
export const openVideo: Action<RouteContext<VideoParams>> = fromOperator(
26+
operators.openVideo
27+
)
3628

3729
export const openGuide: Action<RouteContext<GuideParams>> = async ({
3830
value: routeContext,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { action, Operator, pipe } from 'overmind'
2+
import { Page, RouteContext, VideoParams } from './types'
3+
4+
export const openVideos: <T extends RouteContext>() => Operator<T> = () =>
5+
action(async ({ state, effects }) => {
6+
state.page = Page.VIDEOS
7+
state.currentVideo = null
8+
if (!state.videos.length) {
9+
state.isLoadingVideos = true
10+
state.videos = await effects.request('/backend/videos')
11+
state.isLoadingVideos = false
12+
}
13+
})
14+
15+
export const openVideo: Operator<RouteContext<VideoParams>> = pipe(
16+
openVideos<RouteContext<VideoParams>>(),
17+
action(({ value: routeContext, state }) => {
18+
state.currentVideo = routeContext.params.title
19+
})
20+
)
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
[]
1+
[
2+
{
3+
"title": "Overmind introduction",
4+
"url": "https://www.youtube.com/watch?v=82Aq_ujnBQw",
5+
"shortName": "overmind-introduction",
6+
"type": "beginner"
7+
}
8+
]

0 commit comments

Comments
 (0)