Skip to content

Commit 8934cd1

Browse files
committed
Styling dashboard header and added create repo button
1 parent 1ff2032 commit 8934cd1

6 files changed

Lines changed: 36 additions & 5 deletions

File tree

src/components/app/App.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ div.rounded-input {
1818
color: inherit;
1919
text-decoration: none;
2020
}
21+
.default-button-styles, .default-button-styles:hover, .default-button-styles:focus {
22+
text-decoration: none;
23+
color: #FFF;
24+
}

src/components/app/HeaderControls.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from 'react';
22
import { useTranslation } from 'react-i18next'
33
import PersonIcon from '@mui/icons-material/Face2';
44
import IconButton from '@mui/material/IconButton';
5-
import Chip from '@mui/material/Chip';
65
import { getLoginURL, isLoggedIn } from '../../common/utils';
76
import Languages from './Languages';
7+
import Button from '../common/Button';
88

99
const HeaderControls = () => {
1010
const { t } = useTranslation()
@@ -16,7 +16,7 @@ const HeaderControls = () => {
1616
<IconButton color='primary'>
1717
<PersonIcon fontSize='inherit'/>
1818
</IconButton>:
19-
<Chip label={t('auth.sign_in')} color='primary' style={{height: '40px', borderRadius: '100px', marginLeft: '8px'}} href={getLoginURL()} component='a' />
19+
<Button className='default-button-styles' label={t('auth.sign_in')} color='primary' style={{marginLeft: '8px'}} href={getLoginURL()} component='a' />
2020
}
2121
</div>
2222
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
import AddIcon from '@mui/icons-material/Add';
4+
import Button from './Button';
5+
6+
7+
const AddButton = props => (
8+
<Button icon={<AddIcon fontSize='inherit'/>} {...props} />
9+
)
10+
11+
export default AddButton;

src/components/common/Button.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
3+
import Chip from '@mui/material/Chip';
4+
import merge from 'lodash/merge';
5+
6+
7+
const Button = ({style, ...rest}) => (
8+
<Chip style={merge({height: '40px', borderRadius: '100px', padding: '0 8px'}, (style || {}))} {...rest} />
9+
)
10+
11+
export default Button;

src/components/dashboard/Dashboard.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Carousel from 'react-material-ui-carousel'
55
import { Chip } from '@mui/material'
66
import { PRIMARY, WHITE, PRIMARY_LIGHT } from '../../common/constants'
77
import { getCurrentUser, isLoggedIn } from '../../common/utils';
8+
import AddButton from '../common/AddButton';
89

910
const LinkTo = ({ label }) => <Link to='/' style={{color: PRIMARY, fontSize: '22px', margin: '0 5px'}} className='no-anchor-styles'>{label}</Link>
1011

@@ -43,8 +44,11 @@ const Dashboard = () => {
4344
<div className='col-xs-12 padding-0 flex-vertical-center' style={{fontSize: '22px'}}>
4445
{
4546
authenticated ?
46-
<span>
47-
{t('dashboard.hello')} {username}!
47+
<span style={{display: 'flex', alignItems: 'center', justifyContent: 'space-between', width: '100%'}}>
48+
<span>{t('dashboard.hello')} {username}!</span>
49+
<span>
50+
<AddButton label={t('dashboard.create_repository')} color='primary' onClick={() => {}} />
51+
</span>
4852
</span>:
4953
<span>
5054
{t('dashboard.welcome_line')} <LinkTo label={t('auth.sign_in')} /> {t('common.or')} <LinkTo label={t('auth.register')} />

src/i18n/locales/en/translations.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"name": "Dashboard",
77
"welcome_line": "Welcome to OCL.",
88
"take_a_tour": "Take a tour",
9-
"hello": "Hello"
9+
"hello": "Hello",
10+
"create_repository": "Create Repository"
1011
},
1112
"my_repositories": {
1213
"name": "My repositories"

0 commit comments

Comments
 (0)