Skip to content

Commit

Permalink
#97 - WIP - Adds react-router-dom. Adds wip version of details page. …
Browse files Browse the repository at this point in the history
…Slices main view into smaller components.
  • Loading branch information
mrpiotr-dev committed Jul 28, 2020
1 parent 7b99150 commit 897b06d
Show file tree
Hide file tree
Showing 11 changed files with 424 additions and 76 deletions.
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
13 changes: 13 additions & 0 deletions src/components/cells/internal-link.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { clearKey } from '../../helpers/text';

export default function generateInternalLinkCell(value) {
const to = clearKey(value);

return (
<Link to={to}>
{value}
</Link>
);
}
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
31 changes: 18 additions & 13 deletions src/components/table/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Sorting from '../sorting/sorting';
import Filters from '../filters/filters';
import LinkCellRenderer from '../cells/internal-link';
import {
StyledTh,
StyledTable,
Expand All @@ -19,6 +20,11 @@ import {
import Icon from '../icon/icon';
import link from '../../icons/link.svg';

const classNames = new Map([
['company', 'fixed'],
['system', 'fixed fixed-system'],
]);

export default class Table extends Component {
/* Filter Builter. Builds all the filters in the table based on JSON Data */
getFilters(fixed = false) {
Expand Down Expand Up @@ -179,24 +185,25 @@ export default class Table extends Component {
/* If content of the cell (value) is just a single line of text then render
** goes as follows:
*/
const className = classNames.get(category) || '';

if (typeof value === 'string') {
let content = url ? stringLink : (<p>{value}</p>);

if (category === 'company') {
content = LinkCellRenderer(ds);
}

return (
<td
title={title}
key={category}
className={
category === 'company' ? 'fixed' : category === 'system' ? 'fixed fixed-system' : ''
}
className={className}
id={`${id}${category}`}
>
{url ? (
<div className="cell-wrapper">{stringLink}</div>
) : (
<div className="cell-wrapper">
<p>{value}</p>
</div>
)}
<div className="cell-wrapper">
{content}
</div>
</td>
);
}
Expand All @@ -212,9 +219,7 @@ export default class Table extends Component {
<td
key={category}
id={`${id}${category}`}
className={
category === 'company' ? 'fixed' : category === 'system' ? 'fixed fixed-system' : ''
}
className={className}
>
<div className="cell-wrapper">
<ul>
Expand Down
11 changes: 5 additions & 6 deletions src/components/topBar/top-bar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { StyledTopBar, StyledBrand } from './top-bar.styles';
import { Link } from 'react-router-dom';

import { StyledTopBar, StyledBrand } from './top-bar.styles';
import Logo from '../logo/logo';
import Social from '../social/social';

Expand All @@ -10,15 +11,13 @@ const TopBar = ({ scroll }) => (
<StyledBrand scroll={scroll}>
<Logo tab={1} />
<figcaption>
<a
<Link
to="/"
tabIndex={1}
href="http://uxpin.com"
target="_blank"
rel="noopener noreferrer"
title="UXPin - The Design Systems Platform"
>
The Design Systems Platform
</a>
</Link>
</figcaption>
</StyledBrand>
<Social
Expand Down
93 changes: 65 additions & 28 deletions src/containers/appContainer/app-container.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import React, { Component } from 'react';
import {
BrowserRouter, Switch, Route,
} from 'react-router-dom';

import TableContainer from '../tableContainer/table-container';
import HeaderContainer from '../headerContainer/header-container';
import InfoContainer from '../infoContainer/info-container';
Expand All @@ -8,6 +12,7 @@ import UXPinPromo from '../../components/uxpinPromo/uxpin-promo';
import Footer from '../../components/footer/footer';

import StyledTwoColumns from './app-container.styles';
import DetailsPage from '../detailsPage/details-page';

import prototyping from '../../assets/powerful-prototyping.png';
import deck from '../../assets/icon-board.png';
Expand Down Expand Up @@ -35,34 +40,66 @@ export default class App extends Component {

return (
<main>
<HeaderContainer scroll={scroll} />
<TableContainer scroll={scroll} scrollUpdate={this.updateScroll} />
<InfoContainer>
<SectionHeader content="why adele?" id="adele-info" />
<AdeleInfo />
<SectionHeader content="do you need help with your system?" id="uxpin-info" />
<StyledTwoColumns>
<UXPinPromo
header="Evangelize Design System with a Free Template!"
text="40+ Slides ready for action. Perfect for team and stakeholder presentation.
Available as a powerpoint and keynote deck."
buttonLabel="Learn more & download"
alt="Slide Icon"
image={deck}
link="https://www.uxpin.com/evangelizing-design-system-roi-template?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
/>
<UXPinPromo
header="UXPin: Prototype and Manage Your Design System"
text="Join thousands of companies (including PayPal, Sapient and HBO)
and optimize your design process with UXPin."
buttonLabel="Start a free trial now!"
alt="Prototyping Icon"
image={prototyping}
link="https://www.uxpin.com?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
/>
</StyledTwoColumns>
</InfoContainer>
<Footer />
<BrowserRouter>
<Switch>
<Route path="/:id">
<DetailsPage />
<InfoContainer>
<SectionHeader content="do you need help with your system?" id="uxpin-info" />
<StyledTwoColumns>
<UXPinPromo
header="Evangelize Design System with a Free Template!"
text="40+ Slides ready for action. Perfect for team and stakeholder presentation.
Available as a powerpoint and keynote deck."
buttonLabel="Learn more &amp; download"
alt="Slide Icon"
image={deck}
link="https://www.uxpin.com/evangelizing-design-system-roi-template?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
/>
<UXPinPromo
header="UXPin: Prototype and Manage Your Design System"
text="Join thousands of companies (including PayPal, Sapient and HBO)
and optimize your design process with UXPin."
buttonLabel="Start a free trial now!"
alt="Prototyping Icon"
image={prototyping}
link="https://www.uxpin.com?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
/>
</StyledTwoColumns>
</InfoContainer>
</Route>
<Route exact path="/">
<HeaderContainer scroll={scroll} />
<TableContainer scroll={scroll} scrollUpdate={this.updateScroll} />
<InfoContainer>
<SectionHeader content="why adele?" id="adele-info" />
<AdeleInfo />
<SectionHeader content="do you need help with your system?" id="uxpin-info" />
<StyledTwoColumns>
<UXPinPromo
header="Evangelize Design System with a Free Template!"
text="40+ Slides ready for action. Perfect for team and stakeholder presentation.
Available as a powerpoint and keynote deck."
buttonLabel="Learn more &amp; download"
alt="Slide Icon"
image={deck}
link="https://www.uxpin.com/evangelizing-design-system-roi-template?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
/>
<UXPinPromo
header="UXPin: Prototype and Manage Your Design System"
text="Join thousands of companies (including PayPal, Sapient and HBO)
and optimize your design process with UXPin."
buttonLabel="Start a free trial now!"
alt="Prototyping Icon"
image={prototyping}
link="https://www.uxpin.com?utm_source=adele.uxpin.com&utm_medium=upartner&utm_campaign=Adele"
/>
</StyledTwoColumns>
</InfoContainer>
</Route>
</Switch>
<Footer />
</BrowserRouter>
</main>
);
}
Expand Down
Loading

0 comments on commit 897b06d

Please sign in to comment.