-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4954 from ampproject/feature/4707-done-screen
Setup wizard: Done screen
- Loading branch information
Showing
68 changed files
with
1,288 additions
and
666 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
32 changes: 32 additions & 0 deletions
32
assets/src/setup/components/__mocks__/user-context-provider.js
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,32 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createContext } from '@wordpress/element'; | ||
|
||
export const User = createContext(); | ||
|
||
/** | ||
* MOCK. | ||
* | ||
* @param {Object} props | ||
* @param {any} props.children | ||
*/ | ||
export function UserContextProvider( { children } ) { | ||
return ( | ||
<User.Provider value={ | ||
{ | ||
savingDeveloperToolsOption: false, | ||
} | ||
}> | ||
{ children } | ||
</User.Provider> | ||
); | ||
} | ||
UserContextProvider.propTypes = { | ||
children: PropTypes.any, | ||
}; |
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,37 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.css'; | ||
|
||
/** | ||
* A component providing a UI for helpful info. | ||
* | ||
* @param {Object} props Component props. | ||
* @param {?string} props.children Notice content, not including the icon. | ||
* @param {?string} props.className Optional extra class names. | ||
* @param {?Object} props.icon An SVG icon Component | ||
*/ | ||
export function AMPInfo( { children, className, icon: Icon } ) { | ||
const classNames = [ | ||
className ? className : '', | ||
'amp-info', | ||
].filter( ( item ) => item ); | ||
|
||
return ( | ||
<div className={ classNames.join( ' ' ) }> | ||
{ Icon && <Icon className="amp-info__icon" /> } | ||
{ children } | ||
</div> | ||
); | ||
} | ||
|
||
AMPInfo.propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
icon: PropTypes.func, | ||
}; |
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,13 @@ | ||
.amp-info { | ||
display: inline-block; | ||
font-size: 13px; | ||
font-weight: 600; | ||
margin-top: 0.5rem; | ||
margin-bottom: 2rem; | ||
margin-left: 1rem; | ||
} | ||
|
||
.amp-info__icon { | ||
float: left; | ||
margin: 0 0.5rem; | ||
} |
29 changes: 29 additions & 0 deletions
29
assets/src/setup/components/amp-info/test/__snapshots__/index.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { create } from 'react-test-renderer'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { AMPInfo } from '..'; | ||
import { IconMobile } from '../../svg/icon-mobile'; | ||
|
||
describe( 'AMPInfo', () => { | ||
it( 'matches snapshots', () => { | ||
let wrapper = create( | ||
<AMPInfo />, | ||
); | ||
expect( wrapper.toJSON() ).toMatchSnapshot(); | ||
|
||
wrapper = create( | ||
<AMPInfo className="my-class" icon={ ( props ) => <IconMobile { ...props } /> }> | ||
{ 'Component children' } | ||
</AMPInfo>, | ||
); | ||
expect( wrapper.toJSON() ).toMatchSnapshot(); | ||
} ); | ||
} ); |
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
43 changes: 37 additions & 6 deletions
43
assets/src/setup/components/amp-notice/test/__snapshots__/index.js.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.