Skip to content

Commit

Permalink
Update landing page (#3032)
Browse files Browse the repository at this point in the history
* Add WhatsNewModal

* Add video to hero
  • Loading branch information
julieg18 authored Dec 7, 2021
1 parent 273c6bf commit 2e5f1e0
Show file tree
Hide file tree
Showing 9 changed files with 451 additions and 32 deletions.
27 changes: 18 additions & 9 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@
"no-duplicate-selectors": null,
"declaration-colon-newline-after": null,
"value-list-comma-newline-after": null,
"property-no-unknown": [true, {
"ignoreProperties": ["composes"]
}],
"selector-pseudo-class-no-unknown": [true, {
"ignorePseudoClasses": ["global", "local"]
}],
"at-rule-no-unknown": [true, {
"ignoreAtRules": ["mixin"]
}],
"property-no-unknown": [
true,
{
"ignoreProperties": ["composes"]
}
],
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["global", "local"]
}
],
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["mixin"]
}
],
"selector-class-pattern": null,
"keyframes-name-pattern": null
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"start": "node ./src/server/index.js",
"heroku-postbuild": "./scripts/heroku-deploy.sh",
"test": "jest",
"format-staged": "pretty-quick --staged --no-restage --bail",
"format-staged": "pretty-quick --staged --no-restage --bail --pattern '**/*.{js,jsx,md,tsx,ts,json}'",
"format-check": "prettier --check '**/*.{js,jsx,md,tsx,ts,json}'",
"format-all": "prettier --write '**/*.{js,jsx,md,tsx,ts,json}'",
"format": "prettier --write",
Expand Down Expand Up @@ -72,6 +72,7 @@
"react-collapse": "^5.1.1",
"react-collapsible": "^2.7.0",
"react-dom": "^17.0.2",
"react-focus-lock": "^2.6.0",
"react-ga": "^3.3.0",
"react-helmet": "^6.1.0",
"react-popover": "^0.5.10",
Expand Down
31 changes: 18 additions & 13 deletions src/components/Home/LandingHero/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React, { useEffect, useCallback, useState } from 'react'
// import React, { useEffect, useCallback, useState } from 'react'
import React, { useCallback } from 'react'
import cn from 'classnames'

import ShowOnly from '../../ShowOnly'
import Link from '../../Link'
import DownloadButton from '../../DownloadButton'
import TwoRowsButton from '../../TwoRowsButton'
import GithubLine from './GithubLine'
import Video from '../UseCases/Video'
import { scrollIntoLayout, ease } from '../../../utils/front/scroll'
import { logEvent } from '../../../utils/front/ga'

Expand All @@ -16,16 +18,16 @@ interface ILandingHeroProps {
}

const LandingHero: React.FC<ILandingHeroProps> = ({ scrollToRef }) => {
const [activeCommand, setActiveCommand] = useState(0)
// const [activeCommand, setActiveCommand] = useState(0)

useEffect(() => {
const interval = setInterval(
() => setActiveCommand(prev => (prev + 1) % 4),
3000
)
// useEffect(() => {
// const interval = setInterval(
// () => setActiveCommand(prev => (prev + 1) % 4),
// 3000
// )

return (): void => clearInterval(interval)
}, [])
// return (): void => clearInterval(interval)
// }, [])

const scrollToUseCases = useCallback(() => {
logEvent('button', 'how-it-works')
Expand Down Expand Up @@ -82,8 +84,8 @@ const LandingHero: React.FC<ILandingHeroProps> = ({ scrollToRef }) => {
</div>
</div>

<ShowOnly on="desktop">
<div className={styles.commands}>
{/* <ShowOnly on="desktop"> */}
{/* <div className={styles.commands}>
<div
className={cn(styles.command, activeCommand === 0 && styles.active)}
>
Expand All @@ -108,8 +110,11 @@ const LandingHero: React.FC<ILandingHeroProps> = ({ scrollToRef }) => {
>
<span className={styles.line}>$ dvc push</span>
</div>
</div>
</ShowOnly>
</div> */}
{/* </ShowOnly> */}
<div className={styles.video}>
<Video id="z0s42TxH9oM" />
</div>
</div>
)
}
Expand Down
18 changes: 17 additions & 1 deletion src/components/Home/LandingHero/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
}

.title {
padding-right: 2em;
/* padding-right: 2em; */
padding-right: 30px;
font-family: var(--font-brandon);
font-size: 40px;
font-weight: 500;
Expand Down Expand Up @@ -145,6 +146,21 @@
font-weight: 700;
}

.video {
align-self: center;
flex-basis: 50%;

@media (--sm-scr) {
max-width: 412px;
width: 100%;
margin: 40px 0 0;
}

@media (--xxs-scr) {
margin: 20px 0 0;
}
}

.github {
margin-top: 51px;
font-size: 14px;
Expand Down
111 changes: 111 additions & 0 deletions src/components/Home/WhatsNewModal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
import React, { useEffect, useState } from 'react'
import { StaticImage } from 'gatsby-plugin-image'
import cn from 'classnames'
import FocusLock from 'react-focus-lock'

import Link from '../../Link'

import { ReactComponent as CloseSvg } from '../../../../static/img/close-icon.svg'

import * as styles from './styles.module.css'

const WhatsNewModal: React.FC = () => {
const [isModalOpen, setIsModalOpen] = useState(false)
let pageCloseEventListener: () => void = () => null
let keyupCloseEventListener: () => void = () => null

const closeModal = (): void => {
setIsModalOpen(false)
pageCloseEventListener()
keyupCloseEventListener()
document.body.style.overflow = 'visible'
}

const handleContainerClick = (event: MouseEvent): void => {
const el = event.target as HTMLDivElement

if (el.classList.contains(styles.container)) {
closeModal()
}
}

const handlePageKeyup = (event: KeyboardEvent): void => {
if (event.key === 'Escape') {
closeModal()
}
}

const setupModalEventListeners = (): void => {
document.addEventListener('click', handleContainerClick)
document.addEventListener('keyup', handlePageKeyup)

pageCloseEventListener = (): void =>
document.removeEventListener('click', handleContainerClick)
keyupCloseEventListener = (): void =>
document.removeEventListener('keyup', handlePageKeyup)
document.body.style.overflow = 'hidden'
}

const handleButtonClick = (): void => {
if (isModalOpen) {
closeModal()
} else {
setupModalEventListeners()
setIsModalOpen(true)
}
}

useEffect(() => {
return (): void => {
document.body.style.overflow = 'visible'
}
}, [])

return (
<FocusLock disabled={!isModalOpen}>
<div
className={cn(styles.container, isModalOpen && styles.containerOpen)}
>
<div
aria-label={"What's new"}
tabIndex={0}
role="dialog"
aria-modal="true"
>
<button
onClick={handleButtonClick}
className={cn(styles.button, isModalOpen && styles.buttonExit)}
>
{!isModalOpen && `What's new`}
{isModalOpen && <CloseSvg width={20} height={20} />}
</button>
<div className={styles.modal}>
<Link
className={styles.title}
href="/blog/ml-experiment-versioning"
>
<h2>ML Experiment Versioning</h2>
</Link>
<Link href="/blog/ml-experiment-versioning">
<StaticImage
alt="a description of blog image"
src="../../../../static/uploads/images/2021-12-07/experiment-versioning-cover.png"
className={styles.image}
width={420}
objectFit="contain"
/>
</Link>
<p className={styles.text}>
Versioning machine learning experiments combines the benefits of
version control and experiment tracking.{' '}
<Link href="/blog/ml-experiment-versioning">Read more.</Link>
</p>
</div>
</div>
</div>
</FocusLock>
)
}

export default WhatsNewModal
Loading

0 comments on commit 2e5f1e0

Please sign in to comment.