Skip to content
Snippets Groups Projects
Commit f056d631 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

refactor(faraday): upgrade to pubsweet/ui 3

parent 5c27392b
No related branches found
No related tags found
No related merge requests found
Showing with 162 additions and 125 deletions
......@@ -29,7 +29,7 @@ const Indicator = ({
<Root>
{isFetching && (
<AutoSaveContainer>
<Spinner icon="loader" size={16} />
<Spinner icon="loader" size={3} />
<Info>{progressText}</Info>
</AutoSaveContainer>
)}
......@@ -38,7 +38,7 @@ const Indicator = ({
lastUpdate && (
<AutoSaveContainer>
<IconContainer>
<Icon size={16}>check-circle</Icon>
<Icon size={3}>check-circle</Icon>
</IconContainer>
<Info>{successText || durationParser(lastUpdate)}</Info>
</AutoSaveContainer>
......@@ -47,7 +47,7 @@ const Indicator = ({
error && (
<AutoSaveContainer>
<IconContainer>
<Icon color={theme.colorError} size={16}>
<Icon color={theme.colorError} size={3}>
alert-triangle
</Icon>
</IconContainer>
......
......@@ -7,19 +7,19 @@ const AdminDashboard = ({ history, theme }) => (
<Title>Admin Dashboard</Title>
<CardContainer>
<Card>
<Icon color={theme.colorPrimary} size={32}>
<Icon color={theme.colorPrimary} size={6}>
edit
</Icon>
<span>Journal configuration</span>
</Card>
<Card onClick={() => history.push('/admin/users')}>
<Icon color={theme.colorPrimary} size={32}>
<Icon color={theme.colorPrimary} size={6}>
users
</Icon>
<span>Users</span>
</Card>
<Card>
<Icon color={theme.colorPrimary} size={32}>
<Icon color={theme.colorPrimary} size={6}>
settings
</Icon>
<span>Roles</span>
......
......@@ -2,7 +2,7 @@ import React from 'react'
import { get } from 'lodash'
import { connect } from 'react-redux'
import styled, { withTheme } from 'styled-components'
import { Icon, Menu } from '@pubsweet/ui'
import { Icon, Menu, th } from '@pubsweet/ui'
import { actions } from 'pubsweet-client'
import { ConnectPage } from 'xpub-connect'
import { withJournal } from 'xpub-journal'
......@@ -73,7 +73,9 @@ const Users = ({
<span>Users</span>
</BreadCrumbs>
<AddButton onClick={() => history.push('/admin/users/add')}>
<Icon color={theme.colorPrimary}>plus-circle</Icon>
<Icon color={theme.colorPrimary} size={3}>
plus-circle
</Icon>
&nbsp; Add User
</AddButton>
</Header>
......@@ -81,6 +83,7 @@ const Users = ({
<div>
<span>Bulk actions: </span>
<Menu
inline
onChange={value => value}
options={[
{ value: 'deactivate', label: 'Deactivate' },
......@@ -90,6 +93,7 @@ const Users = ({
/>
<Menu
inline
onChange={value => value}
options={[
{ value: 'sort', label: 'SORT' },
......@@ -98,7 +102,7 @@ const Users = ({
value="sort"
/>
<Icon color={theme.colorPrimary} size={24}>
<Icon color={theme.colorPrimary} size={4}>
search
</Icon>
</div>
......@@ -182,11 +186,11 @@ const AddButton = styled.button`
border: none;
cursor: pointer;
display: flex;
font-family: ${({ theme }) => theme.fontInterface};
font-size: ${({ theme }) => theme.fontSizeBaseSmall};
font-family: ${th('fontInterface')};
font-size: ${th('fontSizeBaseSmall')};
text-align: left;
color: ${({ theme }) => theme.colorPrimary};
background-color: ${({ theme }) => theme.backgroundColor};
color: ${th('colorPrimary')};
background-color: ${th('backgroundColor')};
&:active,
&:focus {
......@@ -205,16 +209,18 @@ const Header = styled.div`
const BreadCrumbs = styled.div`
& span {
font-size: 17px;
font-size: ${th('fontSizeBase')};
text-align: left;
color: ${({ theme }) => theme.colorPrimary};
color: ${th('colorPrimary')};
cursor: pointer;
margin-left: calc(${th('subGridUnit')}*2);
&:after {
content: '>';
padding: 0 10px;
padding: 0 calc(${th('subGridUnit')}*2);
}
&:last-child {
font-size: 24px;
font-size: ${th('fontSizeBase')};
font-weight: bold;
&:after {
content: '';
......@@ -224,52 +230,56 @@ const BreadCrumbs = styled.div`
const SubHeader = styled.div`
align-items: center;
border-bottom: ${({ theme }) => theme.borderDefault};
border-bottom: ${th('borderDefault')};
display: flex;
flex-direction: row;
justify-content: space-between;
margin-top: 20px;
padding-bottom: 10px;
margin-top: ${th('gridUnit')};
padding-bottom: calc(${th('subGridUnit')}*2);
> div:first-child {
display: flex;
align-items: center;
> div {
margin-right: calc(${th('subGridUnit')});
}
}
span {
font-family: ${({ theme }) => theme.fontReading};
font-size: ${({ theme }) => theme.fontSizeBaseSmall};
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBaseSmall')};
text-align: left;
color: ${({ theme }) => theme.colorPrimary};
color: ${th('colorPrimary')};
margin-right: calc(${th('subGridUnit')});
}
`
const Table = styled.table`
border-spacing: 0;
border-collapse: collapse;
margin-top: 10px;
margin-top: calc(${th('subGridUnit')}*2);
width: 100%;
& thead tr {
height: 40px;
border-bottom: ${({ theme }) => theme.borderDefault};
font-family: ${({ theme }) => theme.fontReading};
font-size: ${({ theme }) => theme.fontSizeBaseSmall};
border-bottom: ${th('borderDefault')};
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBaseSmall')};
font-weight: bold;
text-align: left;
color: ${({ theme }) => theme.colorPrimary};
color: ${th('colorPrimary')};
}
`
const Row = styled.tr`
border-bottom: ${({ theme }) => theme.borderDefault};
color: ${({ theme }) => theme.colorPrimary};
font-family: ${({ theme }) => theme.fontReading};
font-size: ${({ theme }) => theme.fontSizeBaseSmall};
border-bottom: ${th('borderDefault')};
color: ${th('colorPrimary')};
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBaseSmall')};
height: 40px;
text-align: left;
&:hover {
background-color: ${({ theme }) => theme.backgroundColorReverse};
background-color: ${th('backgroundColorReverse')};
a {
display: block;
}
......@@ -279,25 +289,25 @@ const Row = styled.tr`
const Tag = styled.span`
border: solid 1px #667080;
text-transform: uppercase;
font-family: ${({ theme }) => theme.fontReading};
font-size: 12px;
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBaseSmall')};
font-weight: bold;
text-align: left;
color: ${({ theme }) => theme.colorPrimary};
padding: 2px 10px;
margin-right: 5px;
color: ${th('colorPrimary')};
padding: 2px calc(${th('subGridUnit')}*2);
margin-right: calc(${th('subGridUnit')});
`
const Role = styled.span`
height: 17px;
font-size: ${({ theme }) => theme.fontSizeBaseSmall};
font-size: ${th('fontSizeBaseSmall')};
text-align: left;
color: ${({ theme }) => theme.colorPrimary};
color: ${th('colorPrimary')};
text-transform: uppercase;
`
const Action = styled(Link)`
color: ${({ theme }) => theme.colorPrimary};
color: ${th('colorPrimary')};
display: none;
`
......
......@@ -18,7 +18,7 @@ const Pagination = ({
</Showing>
<Chevrons>
<IconButton hide={page === 0} onClick={decrementPage}>
<Icon color={theme.colorPrimary} size={18}>
<Icon color={theme.colorPrimary} size={3}>
chevron-left
</Icon>
</IconButton>
......@@ -28,7 +28,7 @@ const Pagination = ({
}`}
</span>
<IconButton hide={!hasMore} onClick={incrementPage}>
<Icon color={theme.colorPrimary} size={18}>
<Icon color={theme.colorPrimary} size={3}>
chevron-right
</Icon>
</IconButton>
......@@ -59,6 +59,7 @@ const IconButton = styled.button`
color: ${({ theme }) => theme.colorPrimary};
background-color: ${({ theme }) => theme.backgroundColor};
opacity: ${({ hide }) => (hide ? 0 : 1)};
cursor: pointer;
&:active,
&:focus {
......
import React from 'react'
import { get } from 'lodash'
import PropTypes from 'prop-types'
import { Button, Icon } from '@pubsweet/ui'
import { Button, Icon, th } from '@pubsweet/ui'
import styled, { css } from 'styled-components'
import { compose, getContext, withHandlers } from 'recompose'
import {
......@@ -35,7 +35,7 @@ const DashboardCard = ({
}`
return version ? (
<Card>
<Card data-test={customId}>
<ListView>
<Top>
<LeftDetails flex="5">
......@@ -161,9 +161,9 @@ export default compose(
// #region styled-components
const defaultText = css`
color: ${({ theme }) => theme.colorText};
font-family: ${({ theme }) => theme.fontReading};
font-size: ${({ theme }) => theme.fontSizeBaseSmall};
color: ${th('colorText')};
font-family: ${th('fontReading')};
font-size: ${th('fontSizeBaseSmall')};
`
const AuthorList = styled.span`
......@@ -179,26 +179,26 @@ const AuthorName = styled.span`
padding-left: 2px;
`
const Author = styled.div`
padding-right: 8px;
padding-right: ${th('subGridUnit')};
`
const AuthorStatus = styled.span`
border: ${({ theme }) => theme.borderDefault};
border: ${th('borderDefault')};
${defaultText};
text-align: center;
text-transform: uppercase;
font-size: 12px;
padding: 0 2px;
`
const ActionButtons = styled(Button)`
${defaultText};
align-items: center;
background-color: ${({ theme }) => theme.colorPrimary};
color: ${({ theme }) => theme.colorTextReverse};
background-color: ${th('colorPrimary')};
color: ${th('colorTextReverse')};
display: flex;
padding: 4px 8px;
text-align: center;
height: calc(${th('subGridUnit')}*5);
`
const LeftDetails = styled.div`
......@@ -221,7 +221,7 @@ const RightDetails = styled.div`
const DetailsView = styled.div`
align-items: center;
border-top: ${({ theme }) => theme.borderDefault};
border-top: ${th('borderDefault')};
display: flex;
flex-direction: row;
justify-content: space-between;
......@@ -268,12 +268,12 @@ const ClickableIcon = styled.div`
const Card = styled.div`
align-items: center;
border: ${({ theme }) => theme.borderDefault};
border: ${th('borderDefault')};
display: flex;
flex-direction: column;
justify-content: flex-start;
margin-bottom: 10px;
background-color: ${({ theme }) => theme.backgroundColorReverse};
background-color: ${th('backgroundColorReverse')};
`
const Top = styled.div`
......@@ -306,8 +306,8 @@ const ManuscriptType = styled.div`
const Title = styled.div`
${defaultText};
font-family: ${({ theme }) => theme.fontHeading};
color: ${({ theme }) => theme.colorPrimary};
font-family: ${th('fontHeading')};
color: ${th('colorPrimary')};
font-weight: bold;
text-align: left;
text-overflow: ellipsis;
......@@ -316,7 +316,7 @@ const Title = styled.div`
`
const Status = styled.div`
border: ${({ theme }) => theme.borderDefault};
border: ${th('borderDefault')};
${defaultText};
font-weight: bold;
padding: 0.2em 0.5em;
......@@ -326,7 +326,7 @@ const Status = styled.div`
const DateField = styled.span`
${defaultText};
margin: 0 8px;
margin: 0 ${th('subGridUnit')};
text-align: left;
`
// #endregion
import React from 'react'
import { Menu } from '@pubsweet/ui'
import { Menu, th } from '@pubsweet/ui'
import { compose, withHandlers } from 'recompose'
import styled from 'styled-components'
......@@ -24,6 +24,7 @@ const DashboardFilters = ({
<FilterGroup>
<span>Owner</span>
<Menu
inline
onChange={changeFilterValue('owner')}
options={getFilterOptions('owner')}
/>
......@@ -31,13 +32,14 @@ const DashboardFilters = ({
<FilterGroup>
<span>Status</span>
<Menu
inline
onChange={changeFilterValue('status')}
options={getFilterOptions('status')}
/>
</FilterGroup>
<FilterGroup>
<span>Sort</span>
<Menu onChange={changeSort} options={sortOptions} />
<Menu inline onChange={changeSort} options={sortOptions} />
</FilterGroup>
</FiltersContainer>
</Root>
......@@ -54,22 +56,22 @@ export default compose(
// #region styles
const Root = styled.div`
border-bottom: ${({ theme }) => theme.borderDefault};
color: ${({ theme }) => theme.colorPrimary};
border-bottom: ${th('borderDefault')};
color: ${th('colorPrimary')};
display: flex;
justify-content: space-between;
margin: 1em 0;
padding-bottom: 1em;
margin: calc(${th('subGridUnit')}*2) 0;
padding-bottom: calc(${th('subGridUnit')}*2);
`
const FiltersContainer = styled.div`
align-items: flex-end;
align-items: center;
display: flex;
> span {
border: ${({ theme }) => theme.borderDefault};
border: ${th('borderDefault')};
margin: 0 0.5em;
padding: 0 5px;
padding: 0 calc(${th('subGridUnit')});
}
`
......@@ -77,10 +79,7 @@ const FilterGroup = styled.div`
align-items: flex-start;
display: flex;
flex-direction: column;
> span {
margin-left: 10px;
}
margin-left: calc(${th('subGridUnit')}*2);
`
// #endregion
# test directories
__tests__
test
tests
powered-test
# asset directories
docs
doc
website
images
assets
# examples
example
examples
# code coverage directories
coverage
.nyc_output
# build scripts
Makefile
Gulpfile.js
Gruntfile.js
# configs
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.*.yml
*.yml
# misc
*.md
import React from 'react'
import { withProps } from 'recompose'
import { Route, Switch } from 'react-router-dom'
import { AuthenticatedComponent } from 'pubsweet-client'
import Login from 'pubsweet-component-login/LoginContainer'
......@@ -19,6 +20,8 @@ import SignUpInvitationPage from 'pubsweet-components-faraday/src/components/Sig
import FaradayApp from './FaradayApp'
const LoginPage = withProps({ passwordReset: false })(Login)
const PrivateRoute = ({ component: Component, ...rest }) => (
<Route
{...rest}
......@@ -33,7 +36,7 @@ const PrivateRoute = ({ component: Component, ...rest }) => (
const Routes = () => (
<FaradayApp>
<Switch>
<Route component={Login} exact path="/login" />
<Route component={LoginPage} exact path="/login" />
<Route component={Signup} exact path="/signup" />
<PrivateRoute component={DashboardPage} exact path="/" />
<PrivateRoute
......
......@@ -14,11 +14,13 @@ const theme = {
colorText: '#333333', // Default font color
colorTextReverse: '#ffffff', // Reverse font color
colorTextPlaceholder: '#595959', // Used for text field placeholders
colorBackground: '#ffffff',
colorQuiet: '#aaa',
fontInterface: 'Noto Sans', // Used for user interface elements by default
fontHeading: 'Noto Sans', // Used for headings
fontReading: 'Noto Serif', // Main reading text
fontWriting: 'Ubuntu Mono', // Font used for writing
fontInterface: "'Noto Sans'",
fontHeading: "'Noto Sans'",
fontReading: "'Noto Serif'",
fontWriting: "'Ubuntu mono'",
fontSizeBase: '18px', // Default font size
fontSizeBaseSmall: '14px', // Smaller variation of fontSizeBase
fontSizeHeading1: '36px', // Size for Heading 1
......@@ -30,14 +32,16 @@ const theme = {
fontLineHeight: '32px', // Default line height
/* Spacing */
gridUnit: '32px', // Base interface space measurement used by elements and typography
subGridUnit: '8px',
gridUnit: '24px', // Base interface space measurement used by elements and typography
subGridUnit: '6px',
borderDefault: '1px solid #667080',
borderRadius: '2px', // Radius value applied to borders throughout the user interface
borderWidth: '1px', // Width value applied to borders
borderStyle: 'solid', // Style applied to borders (eg. solid, dashed)
/* Shadow (for tooltip) */
boxShadow: '0 2px 4px 0 rgba(51, 51, 51, 0.3)',
dropShadow: '0 1px 0 0 #667080', // Default shadow that is applied to elements that float (eg. tooltips, modals)
backgroundColor: '#f6f6f6',
......@@ -46,6 +50,9 @@ const theme = {
transitionDuration: '1.5s', // How long transitions should last
transitionTimingFunction: 'linear', // Which function should be applied to transitions (eg. easein)
transitionDelay: '0s', // How long transitions should be delayed before they begin
transitionDurationM: '0.5s',
transitionDurationS: '0.2s',
transitionDurationXs: '0.1s',
// z indexes
modalIndex: 10000,
......
......@@ -8,11 +8,11 @@
"url": "https://gitlab.coko.foundation/xpub/xpub-faraday"
},
"dependencies": {
"component-aws-download": "0.0.1",
"@pubsweet/component-aws-s3": "^0.1.1",
"@pubsweet/ui": "^2.0.0",
"@pubsweet/ui": "^3.0.0",
"aws-sdk": "^2.197.0",
"babel-core": "^6.26.0",
"component-aws-download": "0.0.1",
"config": "^1.26.2",
"dotenv": "^5.0.0",
"flavors": "^3.3.1",
......@@ -40,19 +40,18 @@
"redux": "^3.6.0",
"redux-form": "^7.0.3",
"redux-logger": "^3.0.1",
"typeface-noto-sans": "^0.0.54",
"typeface-noto-serif": "^0.0.54",
"typeface-ubuntu-mono": "^0.0.54",
"winston": "^2.4.0",
"xpub-connect": "^0.0.3",
"xpub-edit": "^0.0.3",
"xpub-faraday-server": "^0.0.1",
"xpub-journal": "^0.0.3",
"xpub-connect": "^0.0.3",
"xpub-selectors": "^0.0.3",
"xpub-edit": "^0.0.3",
"xpub-upload": "^0.0.3",
"xpub-validators": "^0.0.3",
"xpub-styleguide": "^0.0.3",
"xpub-theme": "^0.0.3",
"typeface-noto-sans": "^0.0.54",
"typeface-noto-serif": "^0.0.54",
"typeface-ubuntu-mono": "^0.0.54"
"xpub-upload": "^0.0.3",
"xpub-validators": "^0.0.3"
},
"devDependencies": {
"babel-core": "^6.26.0",
......@@ -79,8 +78,7 @@
"setupdb": "pubsweet setupdb ./",
"reset": "pubsweet setupdb --clobber ./",
"start": "pubsweet start",
"start-now":
"echo $secret > config/local-development.json && npm run start",
"start-now": "echo $secret > config/local-development.json && npm run start",
"build": "NODE_ENV=production pubsweet build"
}
}
......@@ -185,29 +185,7 @@
redux "^3.6.0"
redux-form "^7.0.3"
"@pubsweet/ui@^2.0.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@pubsweet/ui/-/ui-2.1.0.tgz#67c057ceddb3fb95d2748a52ba571b9750694b2d"
dependencies:
babel-jest "^21.2.0"
classnames "^2.2.5"
enzyme "^3.2.0"
enzyme-adapter-react-15 "^1.0.5"
humps "^2.0.1"
lodash "^4.17.4"
prop-types "^15.5.10"
react "^16.2.0"
react-dom "^16.2.0"
react-feather "^1.0.7"
react-redux "^5.0.2"
react-router-dom "^4.2.2"
react-tag-autocomplete "^5.4.1"
recompose "^0.26.0"
redux "^3.6.0"
redux-form "^7.0.3"
styled-components "^2.4.0"
"@pubsweet/ui@^3.1.0":
"@pubsweet/ui@^3.0.0", "@pubsweet/ui@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@pubsweet/ui/-/ui-3.1.0.tgz#24c25c29fc36e34b9f654fe4378502232f8204fa"
dependencies:
......@@ -8019,8 +7997,8 @@ prosemirror-gapcursor@^1.0.0:
prosemirror-view "^1.0.0"
prosemirror-history@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/prosemirror-history/-/prosemirror-history-1.0.0.tgz#24ba0b3ab0661d837ba5c81b47d3658750c320dc"
version "1.0.1"
resolved "https://registry.yarnpkg.com/prosemirror-history/-/prosemirror-history-1.0.1.tgz#5f8706197ec0824f818d580fd50df82f2abcc77d"
dependencies:
prosemirror-state "^1.0.0"
prosemirror-transform "^1.0.0"
......@@ -8034,11 +8012,11 @@ prosemirror-inputrules@^1.0.0:
prosemirror-transform "^1.0.0"
prosemirror-keymap@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/prosemirror-keymap/-/prosemirror-keymap-1.0.0.tgz#29e9654858c7fd690a41ef7ab6798ca64659e619"
version "1.0.1"
resolved "https://registry.yarnpkg.com/prosemirror-keymap/-/prosemirror-keymap-1.0.1.tgz#03ef32b828e3a859dfb570eb84928bf2e5330bc2"
dependencies:
prosemirror-state "^1.0.0"
w3c-keyname "^1.1.0"
w3c-keyname "^1.1.8"
prosemirror-model@^1.0.0, prosemirror-model@^1.1.0:
version "1.1.0"
......@@ -8054,14 +8032,14 @@ prosemirror-state@^1.0.0, prosemirror-state@^1.0.1:
prosemirror-transform "^1.0.0"
prosemirror-transform@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.0.2.tgz#3b67f1ff639cf195d4392dea053765547d5fd412"
version "1.0.4"
resolved "https://registry.yarnpkg.com/prosemirror-transform/-/prosemirror-transform-1.0.4.tgz#1f3899c3bb87655024fabe73c67d4e7bef169ea6"
dependencies:
prosemirror-model "^1.0.0"
prosemirror-view@^1.0.0:
version "1.0.11"
resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.0.11.tgz#39a5976a6aba0e8479f18241186815af1e126d3f"
version "1.1.1"
resolved "https://registry.yarnpkg.com/prosemirror-view/-/prosemirror-view-1.1.1.tgz#36caa3d1dbd9b5c4210c9fe5c981023d4026b6f4"
dependencies:
prosemirror-model "^1.1.0"
prosemirror-state "^1.0.0"
......@@ -10551,7 +10529,7 @@ w3c-hr-time@^1.0.1:
dependencies:
browser-process-hrtime "^0.1.2"
w3c-keyname@^1.1.0:
w3c-keyname@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/w3c-keyname/-/w3c-keyname-1.1.8.tgz#4e2219663760fd6535b7a1550f1552d71fc9372c"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment