-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hero Flow: Integrate video courses (#58234)
* Hero Flow: Integrate video courses * Setup Header and Footer * Adjust courses header style * Implement courses footer to handle the completion of courses * Turn on config for wpcalypso * Update copy * Enable to non-English users * Refine by review
- Loading branch information
1 parent
a348431
commit 0334e54
Showing
21 changed files
with
279 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Button } from '@automattic/components'; | ||
import { useTranslate } from 'i18n-calypso'; | ||
import React from 'react'; | ||
|
||
interface Props { | ||
isCourseComplete?: boolean; | ||
onStartWriting: () => void; | ||
} | ||
|
||
const CoursesFooter: React.FC< Props > = ( { isCourseComplete, onStartWriting } ) => { | ||
const translate = useTranslate(); | ||
|
||
if ( ! isCourseComplete ) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="courses__footer"> | ||
<div className="courses__footer-content"> | ||
{ translate( | ||
"You did it! Now it's time to put your skills to work and draft your first post." | ||
) } | ||
<Button className="courses__footer-button" onClick={ onStartWriting }> | ||
{ translate( 'Start writing' ) } | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CoursesFooter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import WordPressLogo from 'calypso/components/wordpress-logo'; | ||
import type { ReactElement } from 'react'; | ||
|
||
const CoursesHeader = (): ReactElement => ( | ||
<div className="courses__header"> | ||
<WordPressLogo size={ 24 } className="courses__header-logo" /> | ||
</div> | ||
); | ||
|
||
export default CoursesHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useViewportMatch } from '@wordpress/compose'; | ||
import { useTranslate } from 'i18n-calypso'; | ||
import React from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import VideosUi from 'calypso/components/videos-ui'; | ||
import { COURSE_SLUGS, useCourseData } from 'calypso/data/courses'; | ||
import StepWrapper from 'calypso/signup/step-wrapper'; | ||
import { saveSignupStep, submitSignupStep } from 'calypso/state/signup/progress/actions'; | ||
import CoursesFooter from './footer'; | ||
import CoursesHeader from './header'; | ||
import './style.scss'; | ||
|
||
interface Props { | ||
stepName: string; | ||
goToNextStep: () => void; | ||
} | ||
|
||
export default function CoursesStep( props: Props ): React.ReactNode { | ||
const dispatch = useDispatch(); | ||
const translate = useTranslate(); | ||
const { stepName, goToNextStep } = props; | ||
const isMobile = useViewportMatch( 'small', '<' ); | ||
const courseSlug = COURSE_SLUGS.BLOGGING_QUICK_START; | ||
const { isCourseComplete } = useCourseData( courseSlug ); | ||
const hideSkip = isMobile && isCourseComplete; | ||
|
||
const onStartWriting = () => { | ||
dispatch( submitSignupStep( { stepName } ) ); | ||
goToNextStep(); | ||
}; | ||
|
||
React.useEffect( () => { | ||
dispatch( saveSignupStep( { stepName } ) ); | ||
}, [] ); // eslint-disable-line react-hooks/exhaustive-deps | ||
|
||
return ( | ||
<StepWrapper | ||
className="courses" | ||
isFullLayout | ||
hideFormattedHeader | ||
stepContent={ | ||
<VideosUi | ||
courseSlug={ courseSlug } | ||
HeaderBar={ CoursesHeader } | ||
FooterBar={ () => ( | ||
<CoursesFooter | ||
isCourseComplete={ isCourseComplete } | ||
onStartWriting={ onStartWriting } | ||
/> | ||
) } | ||
/> | ||
} | ||
hideSkip={ hideSkip } | ||
hideNext={ ! hideSkip } | ||
skipLabelText={ translate( 'Draft your first post' ) } | ||
skipButtonAlign="top" | ||
nextLabelText={ translate( 'Start writing' ) } | ||
{ ...props } | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
@import '@wordpress/base-styles/_breakpoints.scss'; | ||
@import '@wordpress/base-styles/_mixins.scss'; | ||
|
||
.courses { | ||
// Not good but this way can easily change the background color for courses step | ||
&::before { | ||
content: ''; | ||
position: fixed; | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
background-color: #101517; | ||
} | ||
|
||
.courses__header { | ||
position: absolute; | ||
top: -60px; | ||
left: 0; | ||
right: 0; | ||
height: 60px; | ||
display: flex; | ||
align-items: center; | ||
padding: 0 20px; | ||
background-color: #151b1e; | ||
|
||
.courses__header-logo { | ||
margin-top: 4px; | ||
fill: #fff; | ||
stroke: #fff; | ||
} | ||
|
||
@include break-small { | ||
padding: 0 24px; | ||
} | ||
} | ||
|
||
.action-buttons { | ||
border: 0; | ||
box-shadow: 0 -1px 0 #2c3234; | ||
background-color: #101517; | ||
|
||
.button.navigation-link.is-borderless { | ||
color: #fff !important; | ||
|
||
svg { | ||
fill: #fff !important; | ||
} | ||
} | ||
|
||
@include break-small { | ||
box-shadow: none; | ||
} | ||
} | ||
|
||
.videos-ui { | ||
position: relative; | ||
width: 100%; | ||
min-height: calc( 100vh - 60px ); | ||
margin-top: 12px; | ||
} | ||
|
||
.courses__footer { | ||
display: none; | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
padding: 0 20px; | ||
box-shadow: 0 -1px 0 #2c3234; | ||
background-color: #101517; | ||
animation: appear 0.3s ease-in-out; | ||
@include reduce-motion( 'animation' ); | ||
|
||
.courses__footer-content { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
width: 100%; | ||
height: 72px; | ||
max-width: 1160px; | ||
margin: 0 auto; | ||
} | ||
|
||
.courses__footer-button { | ||
flex-shrink: 0; | ||
margin-left: 20px; | ||
border-radius: 4px; | ||
border-color: transparent; | ||
color: #101517; | ||
font-weight: 500; | ||
transition: opacity 0.2s ease-out; | ||
|
||
&:hover { | ||
opacity: 0.9; | ||
} | ||
} | ||
|
||
@include break-small { | ||
display: block; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export type StartingPointFlag = 'write' | 'design' | 'skip-to-my-home'; | ||
export type StartingPointFlag = 'write' | 'courses' | 'design' | 'skip-to-my-home'; |
Oops, something went wrong.