Skip to content

Commit

Permalink
fix(web-compare): Add Source explicit labels
Browse files Browse the repository at this point in the history
  • Loading branch information
vio committed Aug 21, 2019
1 parent 93e1684 commit 4fc68d6
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions packages/web-compare/src/components/sources/add/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import cx from 'classnames';
import locale from './locale.json';
import styles from './styles.css';

const Add = ({ className, onSubmit }) => {
const Add = ({ className, onSubmit, placeholder }) => {
const handleFormSubmit = (event) => {
event.preventDefault();
const form = event.target;
Expand All @@ -21,7 +21,7 @@ const Add = ({ className, onSubmit }) => {
type="url"
name="url"
id="url"
placeholder={locale.placeholder}
placeholder={placeholder || locale.placeholder}
required
/>
<button type="submit" class={styles.button}>
Expand All @@ -33,11 +33,13 @@ const Add = ({ className, onSubmit }) => {

Add.defaultProps = {
className: '',
placeholder: '',
};

Add.propTypes = {
className: PropTypes.string,
onSubmit: PropTypes.func.isRequired,
placeholder: PropTypes.string,
};

export default Add;
4 changes: 4 additions & 0 deletions packages/web-compare/src/components/sources/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const Sources = ({
runs,
exampleUrls,
exampleText,
addPlaceholder,
addSource,
removeSource,
}) => {
Expand All @@ -29,6 +30,7 @@ const Sources = ({
<Add
className={styles.add}
onSubmit={addSource}
placeholder={addPlaceholder}
/>

{(sources.length === 0 && exampleUrls.length > 0) && (
Expand All @@ -47,13 +49,15 @@ Sources.defaultProps = {
runs: [],
exampleUrls: [],
exampleText: '',
addPlaceholder: '',
};

Sources.propTypes = {
sources: PropTypes.array, // eslint-disable-line react/forbid-prop-types
runs: PropTypes.array, // eslint-disable-line react/forbid-prop-types
exampleUrls: PropTypes.array, // eslint-disable-line react/forbid-prop-types
exampleText: PropTypes.string,
addPlaceholder: PropTypes.string,
addSource: PropTypes.func.isRequired,
removeSource: PropTypes.func.isRequired,
};
Expand Down
1 change: 1 addition & 0 deletions packages/web-compare/src/pages/browsertime/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Browsertime = (props) => {
runs={runs}
exampleUrls={config.exampleUrls}
exampleText={locale.loadExample}
addPlaceholder={locale.addPlaceholder}
addSource={addSource}
removeSource={removeSource}
/>
Expand Down
3 changes: 2 additions & 1 deletion packages/web-compare/src/pages/browsertime/locale.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Browsertime",
"description": "Side by side comparison for Browsertime stats",
"loadExample": "Load ReactHN vs PreactHN example"
"loadExample": "Load ReactHN vs PreactHN example",
"addPlaceholder": "Browsertime report JSON/Gist URL"
}
1 change: 1 addition & 0 deletions packages/web-compare/src/pages/lighthouse/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const Lighthouse = (props) => {
runs={runs}
exampleUrls={config.exampleUrls}
exampleText={locale.loadExample}
addPlaceholder={locale.addPlaceholder}
addSource={addSource}
removeSource={removeSource}
/>
Expand Down
3 changes: 2 additions & 1 deletion packages/web-compare/src/pages/lighthouse/locale.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"title": "Lighthouse",
"description": "Side by side comparison for Lighthouse stats",
"loadExample": "Load ReactHN example"
"loadExample": "Load ReactHN vs PreactHN example",
"addPlaceholder": "Lighthouse report JSON/Gist URL"
}
1 change: 1 addition & 0 deletions packages/web-compare/src/pages/webpack/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const Webpack = (props) => {
runs={runs}
exampleUrls={config.exampleUrls}
exampleText={locale.loadExample}
addPlaceholder={locale.addPlaceholder}
addSource={addSource}
removeSource={removeSource}
/>
Expand Down
5 changes: 3 additions & 2 deletions packages/web-compare/src/pages/webpack/locale.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"title": "Webpack",
"description": "Side by side comparison for Webpack stats.",
"loadExample": "Load ReactHN example",
"loadExample": "Load React HackerNews example",
"totals": "Totals",
"assets": "Assets",
"modules": "Modules"
"modules": "Modules",
"addPlaceholder": "Webpack stats JSON/Gist URL"
}

0 comments on commit 4fc68d6

Please sign in to comment.