Skip to content

Commit

Permalink
Adding dedicated subpages for every DS (#104)
Browse files Browse the repository at this point in the history
* #97 - WIP - Adds react-router-dom. Adds wip version of details page. Slices main view into smaller components.

* #97 Adds basic css styles

* #97 - Adds icons

* #97 - small styling changes

* #97 - Adds observer to add breadcrumbs + CSS styling adjustments

* #97 - Adds small adjustments in styles. Adds inline documentation to the 'data' service.

* #97 - updates tests specs

(fixes #97)
  • Loading branch information
swistach committed Aug 3, 2020
1 parent 7b99150 commit ca202fa
Show file tree
Hide file tree
Showing 24 changed files with 1,942 additions and 1,061 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ module.exports = {
'class-methods-use-this': 'off',
'no-mixed-operators': 'off',
'jsx-a11y/tabindex-no-positive': 'off',
'import/prefer-default-export': 'off',
},
};
88 changes: 88 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"raw-loader": "^4.0.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.2.0",
"react-svg-inline": "^2.1.1",
"react-test-renderer": "^16.13.1",
"styled-components": "^5.1.1",
Expand Down
46 changes: 46 additions & 0 deletions src/components/cells/internal-link.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import { table } from '../../style_tokens/tokens';
import { clearKey } from '../../helpers/text';

export function InternalLinkCell({ value, route }) {
const to = clearKey(route);

return (
<StyledLink to={to}>
{value}
</StyledLink>
);
}

InternalLinkCell.propTypes = {
route: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
};

export const StyledLink = styled(Link)`
color: ${table.typography.color};
display: flex;
padding-left: ${table.space.cellPadding};
padding-right: ${table.space.cellPadding};
text-decoration: none;
&:hover {
color: ${table.typography.hoveredLink};
text-decoration: underline;
span > svg {
fill: ${table.typography.hoveredLink};
}
}
span {
align-items: center;
display: flex;
height: 24px;
margin-right: 3px;
width: 14px;
}
`;
12 changes: 6 additions & 6 deletions src/components/logo/logo.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* eslint-disable arrow-body-style */
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import SVGInline from 'react-svg-inline';

import logo from '../../icons/uxpin_logo.svg';

const Logo = ({ tab }) => {
return (
<a
href="https://www.uxpin.com?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
target="_blank"
rel="noopener noreferrer"
title="UXPin logo"
<Link
to="/"
tabIndex={tab}
title="UXPin logo"
>
<SVGInline svg={logo} />
</a>
</Link>
);
};

Expand Down
89 changes: 63 additions & 26 deletions src/components/logo/tests/__snapshots__/logo.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -1,32 +1,69 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders Logo correctly 1`] = `
<Logo
tab={0}
>
<a
href="https://www.uxpin.com?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
rel="noopener noreferrer"
tabIndex={0}
target="_blank"
title="UXPin logo"
<BrowserRouter>
<Router
history={
Object {
"action": "POP",
"block": [Function],
"createHref": [Function],
"go": [Function],
"goBack": [Function],
"goForward": [Function],
"length": 1,
"listen": [Function],
"location": Object {
"hash": "",
"pathname": "/",
"search": "",
"state": undefined,
},
"push": [Function],
"replace": [Function],
}
}
>
<SVGInline
classSuffix="-svg"
cleanup={Array []}
cleanupExceptions={Array []}
component="span"
svg="test-file-stub"
<Logo
tab={0}
>
<span
className="SVGInline"
dangerouslySetInnerHTML={
Object {
"__html": "test-file-stub",
}
}
/>
</SVGInline>
</a>
</Logo>
<Link
tabIndex={0}
title="UXPin logo"
to="/"
>
<LinkAnchor
href="/"
navigate={[Function]}
tabIndex={0}
title="UXPin logo"
>
<a
href="/"
onClick={[Function]}
tabIndex={0}
title="UXPin logo"
>
<SVGInline
classSuffix="-svg"
cleanup={Array []}
cleanupExceptions={Array []}
component="span"
svg="test-file-stub"
>
<span
className="SVGInline"
dangerouslySetInnerHTML={
Object {
"__html": "test-file-stub",
}
}
/>
</SVGInline>
</a>
</LinkAnchor>
</Link>
</Logo>
</Router>
</BrowserRouter>
`;
3 changes: 2 additions & 1 deletion src/components/logo/tests/logo.test.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { mount } from 'enzyme';
import React from 'react';
import 'jest-styled-components';
import { BrowserRouter } from 'react-router-dom';

import Logo from '../logo';

it('renders Logo correctly', () => {
const wrapper = mount(<Logo />);
const wrapper = mount(<BrowserRouter><Logo /></BrowserRouter>);
expect(wrapper).toMatchSnapshot();
});
8 changes: 7 additions & 1 deletion src/components/sectionHeader/section-header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ import PropTypes from 'prop-types';
import StyledSectionHeader from './section-header.styles';

const SectionHeader = ({
className,
content,
id,
}) => (
<StyledSectionHeader id={id}>{content}</StyledSectionHeader>
<StyledSectionHeader id={id} className={className}>{content}</StyledSectionHeader>
);

SectionHeader.propTypes = {
className: PropTypes.string,
content: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
};

SectionHeader.defaultProps = {
className: '',
};

export { SectionHeader as default };
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ exports[`renders SectionHeader correctly 1`] = `
}
<SectionHeader
className=""
content="why adele?"
id="test"
>
<styled.h3
className=""
id="test"
>
<h3
Expand Down
Loading

0 comments on commit ca202fa

Please sign in to comment.