on master help sign in
chore: remove old components, fix dangling prop on Header
0d988f0Matt Condon (shrugs)
src/bridge/Bridge.js+1−5
@@ -225,11 +225,7 @@ class Bridge extends React.Component {
225 <Container>
225 <Container>
226 <Row>
226 <Row>
227 <VariableWidthColumn>
227 <VariableWidthColumn>
228− <Header
229− skipRoute={this.skipRoute}
230− wallet={wallet}
231− pointCursor={pointCursor}
228+ <Header wallet={wallet} pointCursor={pointCursor} />
232− />
233
229
234 <Row className={'row wrapper'}>
230 <Row className={'row wrapper'}>
235 <Router
231 <Router
src/bridge/components/OldHeader.jsdeleted−49
@@ -1,49 +0,0 @@
1−import React from 'react';
2−import { Button, Chevron } from '../components/Base';
3−
4−import { getRouteBreadcrumb } from '../lib/router';
5−import { isLast } from '../lib/lib';
6−
7−const Crumbs = props => {
8− const { routeCrumbs, skipRoute } = props;
9− const history = routeCrumbs.reverse();
10−
11− // FIXME probably more straightforward to render them normally and just
12− // return the reversed array of renders
13− const rendered = history.map((route, idx) => {
14− return (
15− <div className={'flex items-center'} key={`history-${idx}`}>
16− <Button
17− size={'s'}
18− type={'link'}
19− color={'black'}
20− key={`history-button-${idx}`}
21− onClick={() => skipRoute(history.size - idx - 1)}>
22− {`${getRouteBreadcrumb(props, route)}`}
23− </Button>
24−
25− {isLast(history.size, idx) ? (
26− <div />
27− ) : (
28− <Chevron className={'h-4 mh-2'} />
29− )}
30− </div>
31− );
32− });
33−
34− return rendered;
35−};
36−
37−const Header = props => (
38− <div className={'flex items-center h-8 pt-4'}>
39− <Crumbs
40− routeCrumbs={props.routeCrumbs}
41− skipRoute={props.skipRoute}
42− networkType={props.networkType}
43− wallet={props.wallet}
44− pointCursor={props.pointCursor}
45− />
46− </div>
47−);
48−
49−export default Header;
src/bridge/components/OldLink.jsdeleted−120
@@ -1,120 +0,0 @@
1−import React from 'react';
2−import PropTypes from 'prop-types';
3−
4−const Link = ({
5− disabled,
6− onClick,
7− className,
8− autoFocus,
9− style,
10− href,
11− target,
12− children,
13− size,
14− color,
15− type,
16−}) => {
17− const _color = disabled ? 'disabled' : color;
18− const _s = getStyles(styleManifest, type, _color, size);
19− const _disabled = disabled ? 'disabled' : '';
20−
21− return (
22− <a
23− className={`${_s} ${className} ${_disabled} sans`}
24− style={style}
25− onClick={onClick}
26− disabled={disabled}
27− autoFocus={autoFocus}
28− href={href}
29− target={target}>
30− {children}
31− </a>
32− );
33−};
34−
35−const getStyles = (m, t, c, s) => `${m[t][c]} ${m[t][s]} ${m[t]['all']}`;
36−
37−const styleManifest = {
38− link: {
39− // Color selection
40− blue: 'blue',
41− black: 'black',
42− green: 'green',
43− yellow: 'yellow',
44− gray: 'gray-50',
45− disabled: 'gray-30',
46− // Size selection
47− s: 'text-sans-serif fs-35 mb-0',
48− m: 'text-sans-serif fs-4 mb-1',
49− l: 'fs-5 mb-2',
50− // Applied to all link buttons
51− all: 'bg-transparent text-400 underline user-select-auto p-0',
52− },
53− outline: {
54− // Color selection
55− blue: 'b-blue blue',
56− black: 'b-black black',
57− green: 'b-green green',
58− yellow: 'b-yellow yellow',
59− gray: 'b-gray-50 gray-50',
60− disabled: 'b-gray-30 gray-30',
61− // Size selection
62− s: 'h-7 ph-2 fs-3 b-1',
63− m: 'h-9 ph-4 fs-4 b-2',
64− l: 'h-13 ph-6 fs-5 b-2',
65− // Applied to all outline buttons
66− all: 'bg-transparent b-solid',
67− },
68− text: {
69− // Color selection
70− blue: 'blue',
71− black: 'black',
72− green: 'green',
73− yellow: 'yellow',
74− gray: 'gray-50',
75− disabled: 'gray-30',
76− // Size selection
77− s: 'h-6 ph-2 fs-35',
78− m: 'h-9 ph-4 fs-4',
79− l: 'h-13 ph-6 fs-5',
80− // Applied to all outline buttons
81− all: 'bg-transparent b-0',
82− },
83− block: {
84− // Color selection
85− blue: 'bg-blue b-blue',
86− black: 'bg-black b-black',
87− green: 'bg-green b-green',
88− yellow: 'bg-yellow b-yellow',
89− gray: 'bg-gray b-gray',
90− disabled: 'b-gray-30 bg-gray-30',
91− // Size selection
92− s: 'h-6 ph-2 fs-3 sans',
93− m: 'h-9 ph-4 fs-4',
94− l: 'h-13 ph-6 fs-5',
95− // Applied to all block buttons
96− all: 'white b-2 br-solid',
97− },
98−};
99−
100−Link.propTypes = {
101− disabled: PropTypes.bool,
102− onClick: PropTypes.func,
103− className: PropTypes.string,
104− children: PropTypes.node,
105− autoFocus: PropTypes.bool,
106− style: PropTypes.object,
107−};
108−
109−Link.defaultProps = {
110− className: '',
111− autoFocus: false,
112− onClick: () => {},
113− disabled: false,
114− size: 'm',
115− color: 'blue',
116− type: 'block',
117− style: {},
118−};
119−
120−export default Link;
src/bridge/components/OldTextArea.jsdeleted−122
@@ -1,122 +0,0 @@
1−import React from 'react';
2−import PropTypes from 'prop-types';
3−
4−const TextArea = ({
5− // DOM props
6− name,
7− placeholder,
8− value,
9− className,
10− row,
11− col,
12− disabled,
13− autoFocus,
14− maxLength,
15− readOnly,
16− // events
17− onChange,
18− onFocus,
19− onBlur,
20− format,
21− size,
22− children,
23− // validated component props (if wrapped)
24− isValidated,
25− validationClassnames,
26− focussed,
27− beenFocussed,
28− hasSubmitted,
29− displayPass,
30− displayFailure,
31− error,
32−}) => {
33− const _disabled = disabled === true ? 'br-gray-30' : '';
34−
35− const s = getStyles(styleManifest, format, size);
36−
37− // This enables all children of this component to share the state of this
38− // component.
39− const childrenWithProps = React.Children.map(children, child =>
40− React.cloneElement(child, { displayPass, displayFailure, focussed })
41− );
42−
43− return (
44− <div className={'rel'}>
45− <textarea
46− className={`bw-2 flex bs-solid ${s} ${validationClassnames} ${_disabled} ${className}`}
47− onChange={e => onChange(e)}
48− onFocus={e => onFocus(e)}
49− onBlur={e => onBlur(e)}
50− placeholder={placeholder}
51− name={name}
52− value={value}
53− // row={row}
54− // col={col}
55− disabled={disabled}
56− autoFocus={autoFocus}
57− maxLength={maxLength}
58− readOnly={readOnly}
59− />
60− {childrenWithProps}
61− {displayFailure === true && isValidated === true ? (
62− <div className={'yellow text-600 h-6 mt-1'}>{error}</div>
63− ) : (
64− <div />
65− )}
66− </div>
67− );
68−};
69−
70−const getStyles = (m, t, s) => `${m[t][s] || ''}`;
71−
72−const styleManifest = {
73− normal: {
74− l: 'h-80 fs-7 ph-4',
75− m: 'h-40 fs-35 ph-4',
76− s: 'h-24 fs-35 ph-1',
77− },
78−};
79−
80−TextArea.propTypes = {
81− disabled: PropTypes.bool,
82− onChange: PropTypes.func,
83− onBlur: PropTypes.func,
84− onFocus: PropTypes.func,
85− className: PropTypes.string,
86− children: PropTypes.node,
87− autoFocus: PropTypes.bool,
88− maxLength: PropTypes.number,
89− readOnly: PropTypes.bool,
90− name: PropTypes.string,
91− value: PropTypes.string,
92− row: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
93− col: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
94− isSelected: PropTypes.bool,
95− hasBeenSelected: PropTypes.bool,
96− hasSubmitted: PropTypes.bool,
97− displayPass: PropTypes.bool,
98− displayFailure: PropTypes.bool,
99− error: PropTypes.string,
100− validationClassnames: PropTypes.string,
101−};
102−
103−TextArea.defaultProps = {
104− disabled: false,
105− onChange: () => {},
106− onBlur: () => {},
107− onFocus: () => {},
108− value: '',
109− name: '',
110− className: '',
111− isSelected: false,
112− hasBeenSelected: false,
113− hasSubmitted: false,
114− displayPass: false,
115− displayFailure: false,
116− error: '',
117− size: 'm',
118− format: 'normal',
119− validationClassnames: 'br-gray-50 f-br-blue outline-blue',
120−};
121−
122−export default TextArea;