Commit 9005f54d authored by Jen Spencer's avatar Jen Spencer

refactor(icons): use new Icon component in AppBar component

parent 8bd28dbc
Pipeline #8582 failed with stages
in 12 minutes and 12 seconds
...@@ -3,9 +3,29 @@ import styled from 'styled-components' ...@@ -3,9 +3,29 @@ import styled from 'styled-components'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { override, th } from '@pubsweet/ui-toolkit' import { override, th } from '@pubsweet/ui-toolkit'
import { Icon } from '../atoms' import { Icon2 } from '../atoms'
import Action from './Action' import Action from './Action'
const UserIcon = props => (
<Icon2 iconName="User" overrideName="@pubsweet.ui.AppBar.User" {...props} />
)
const StyledUserIcon = styled(UserIcon)`
height: calc(2 * ${th('gridUnit')})
width: calc(2 * ${th('gridUnit')})
${override('ui.AppBar.UserIcon')}
`
const PowerIcon = props => (
<Icon2 iconName="Power" overrideName="@pubsweet.ui.AppBar.Power" {...props} />
)
const StyledPowerIcon = styled(PowerIcon)`
height: calc(2 * ${th('gridUnit')})
width: calc(2 * ${th('gridUnit')})
${override('ui.AppBar.PowerIcon')}
`
// #region styled-components // #region styled-components
const Root = styled.nav` const Root = styled.nav`
display: flex; display: flex;
...@@ -78,7 +98,7 @@ const DefaultRightComponent = ({ user, onLogoutClick, loginLink }) => ( ...@@ -78,7 +98,7 @@ const DefaultRightComponent = ({ user, onLogoutClick, loginLink }) => (
<Section> <Section>
{user && ( {user && (
<Item> <Item>
<Icon size={2}>user</Icon> <StyledUserIcon />
{user.username} {user.username}
{user.admin ? ' (admin)' : ''} {user.admin ? ' (admin)' : ''}
</Item> </Item>
...@@ -86,7 +106,7 @@ const DefaultRightComponent = ({ user, onLogoutClick, loginLink }) => ( ...@@ -86,7 +106,7 @@ const DefaultRightComponent = ({ user, onLogoutClick, loginLink }) => (
{user && ( {user && (
<Item> <Item>
<Icon size={2}>power</Icon> <StyledPowerIcon />
<Action onClick={onLogoutClick}>Logout</Action> <Action onClick={onLogoutClick}>Logout</Action>
</Item> </Item>
)} )}
......
Markdown is supported
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