Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ Marketing website for Commit (commit.dev)
### Importing static images

**1)** Place the image you want to display in the `/static/` folder
**2)** Display the image with [`<Image>`](./components/media/image.js) component:
**2)** Display the image with [`<StaticImage>`](./components/media/static-image.js) component:
```jsx
<Image {...getStaticImage('my-image-name.png')} alt="My image" />
import { StaticImage } from 'components'

<StaticImage name="my-image-name.png" alt="My image" />
```

Images are automatically generated at build time and lazy-loaded at run time.
Expand Down Expand Up @@ -34,9 +36,11 @@ Processing ~/path/to/video.mov (13.4 MB)...
-- generated static/videos/video.mp4 (1.28 MB)
```

**3)** Use generated files with [`<BackgroundVideo>`](./components/media/video.js) component:
**3)** Use generated files with [`<StaticBackgroundVideo>`](./components/media/background-video.js) component:
```jsx
<BackgroundVideo {...getStaticVideo('video')} alt="My background video" />
import { StaticBackgroundVideo } from 'components'

<StaticBackgroundVideo name="video" alt="My background video" />
```

Videos are lazy-loaded at run time.
1 change: 1 addition & 0 deletions components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export { default as SocialIcons } from './social-icons'
export { default as Testimonials } from './testimonials'
export { default as Text } from './text'
export { default as TextArea } from './textarea'
export * from './media'
7 changes: 7 additions & 0 deletions components/media/background-video.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Video } from './video'

function BackgroundVideo(props) {
return <Video muted data-autoplay="" loop playsinline {...props} />
}

export { BackgroundVideo }
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion components/media/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ Image.propTypes = {
className: string,
}

export default Image
export { Image }
8 changes: 6 additions & 2 deletions components/media/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const GlobalMediaStyles = createGlobalStyle`
${lazyStyles}
`

export { default as Image } from './image'
export { Video, BackgroundVideo } from './video'
export { Image } from './image'
export { StaticImage } from './static-image'
export { Video } from './video'
export { StaticVideo } from './static-video'
export { BackgroundVideo } from './background-video'
export { StaticBackgroundVideo } from './static-background-video'
export { GlobalMediaStyles }
7 changes: 7 additions & 0 deletions components/media/static-background-video.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { StaticVideo } from './static-video'

function StaticBackgroundVideo(props) {
return <StaticVideo muted data-autoplay="" loop playsinline {...props} />
}

export { StaticBackgroundVideo }
14 changes: 14 additions & 0 deletions components/media/static-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { string } from 'prop-types'

import { getStaticImage } from './get-static-image'
import { Image } from './image'

function StaticImage({ name, ...otherProps }) {
return <Image {...getStaticImage(name)} {...otherProps} />
}

StaticImage.propTypes = {
name: string,
}

export { StaticImage }
14 changes: 14 additions & 0 deletions components/media/static-video.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { string } from 'prop-types'

import { getStaticVideo } from './get-static-video'
import { Video } from './video'

function StaticVideo({ name, ...otherProps }) {
return <Video {...getStaticVideo(name)} {...otherProps} />
}

StaticVideo.propTypes = {
name: string,
}

export { StaticVideo }
6 changes: 1 addition & 5 deletions components/media/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,4 @@ Video.propTypes = {
className: string,
}

function BackgroundVideo(props) {
return <Video muted data-autoplay="" loop playsinline {...props} />
}

export { Video, BackgroundVideo }
export { Video }
8 changes: 3 additions & 5 deletions sections/platform-section/features/community.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import React from 'react'

import { Heading, Text } from 'components'
import { Heading, Text, StaticBackgroundVideo } from 'components'

import { BackgroundVideo } from '../../../components/media'
import { getStaticVideo } from '../../../helpers/get-static-video'
import { StyledFeaturesListItem } from '../styled-features-list-item'

function CommunityFeature(props) {
return (
<StyledFeaturesListItem
{...props}
media={
<BackgroundVideo
{...getStaticVideo('community')}
<StaticBackgroundVideo
name="community"
alt="Screenshot of Commit's Community page"
/>
}
Expand Down
8 changes: 3 additions & 5 deletions sections/platform-section/features/opportunities.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import React from 'react'

import { Text, Heading } from 'components'
import { Text, Heading, StaticBackgroundVideo } from 'components'

import { BackgroundVideo } from '../../../components/media'
import { getStaticVideo } from '../../../helpers/get-static-video'
import { StyledFeaturesListItem } from '../styled-features-list-item'

function OpportunitiesFeature(props) {
return (
<StyledFeaturesListItem
{...props}
media={
<BackgroundVideo
{...getStaticVideo('community')}
<StaticBackgroundVideo
name="community"
alt="Screenshot of Commit's Opportunities page"
/>
}
Expand Down
8 changes: 3 additions & 5 deletions sections/platform-section/features/profile.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import React from 'react'

import { Text, Heading } from 'components'
import { Text, Heading, StaticBackgroundVideo } from 'components'

import { BackgroundVideo } from '../../../components/media'
import { getStaticVideo } from '../../../helpers/get-static-video'
import { StyledFeaturesListItem } from '../styled-features-list-item'

function ProfileFeature(props) {
return (
<StyledFeaturesListItem
{...props}
media={
<BackgroundVideo
{...getStaticVideo('profile')}
<StaticBackgroundVideo
name="profile"
alt="Screenshot of Commit's Opportunities page"
/>
}
Expand Down