-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
299 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// @flow | ||
|
||
import React from 'react' | ||
import {List, Map} from 'immutable' | ||
import {Tooltip, IconButton} from 'evergreen-ui' | ||
import { | ||
sortStudiesByType, | ||
areaTypeConstants, | ||
Student, | ||
} from '@gob/object-student' | ||
|
||
type Props = { | ||
student: Student, | ||
} | ||
|
||
type State = { | ||
showAreaPickerFor: Map<string, boolean>, | ||
} | ||
|
||
export class AreaOfStudyBar extends React.PureComponent<Props, State> { | ||
state = { | ||
showAreaPicker: false, | ||
} | ||
|
||
addArea = () => { | ||
this.setState(() => ({showAreaPicker: true})) | ||
} | ||
|
||
render() { | ||
let props = this.props | ||
let {student} = props | ||
let {showAreaPickerFor} = this.state | ||
|
||
let sortedStudies = List(sortStudiesByType([...student.studies])) | ||
|
||
let activeAreas = sortedStudies.map(area => ( | ||
<span key={`${area.name}${String(area.revision)}`}> | ||
{area.name} | ||
</span> | ||
/*<AreaOfStudy | ||
key={`${area.name}${String(area.revision)}`} | ||
areaOfStudy={area} | ||
student={student} | ||
/>*/ | ||
)) | ||
|
||
return ( | ||
<> | ||
{[...activeAreas.values()]} | ||
<Tooltip content="Add an Area of Study"> | ||
<IconButton onClick={this.addArea} icon="plus" /> | ||
</Tooltip> | ||
</> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// @flow | ||
|
||
import * as React from 'react' | ||
import styled, {css} from 'styled-components' | ||
import { | ||
Avatar, | ||
IconButton, | ||
Tooltip, | ||
Popover, | ||
Button, | ||
BackButton, | ||
SearchInput, | ||
} from 'evergreen-ui' | ||
import {AreaOfStudyBar} from './area-of-study-bar' | ||
|
||
const Container = styled.nav` | ||
margin: 0; | ||
display: flex; | ||
flex-flow: row nowrap; | ||
` | ||
|
||
const Spacer = styled.div` | ||
${props => | ||
props.static && | ||
css` | ||
width: 24px; | ||
`}; | ||
${props => | ||
props.flex && | ||
css` | ||
flex: 1; | ||
`}; | ||
` | ||
|
||
class StudentSummaryBar extends React.Component { | ||
render() { | ||
let {student} = this.props | ||
return ( | ||
<> | ||
<Avatar name={student.name} size={24} /> | ||
|
||
<AreaOfStudyBar student={student} /> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export class StudentToolbar extends React.Component { | ||
render() { | ||
let {student} = this.props | ||
|
||
return ( | ||
<Container> | ||
<Tooltip content="Back to student list"> | ||
<BackButton /> | ||
</Tooltip> | ||
|
||
<Spacer static /> | ||
|
||
<Tooltip content="Undo"> | ||
<IconButton icon="undo" /> | ||
</Tooltip> | ||
<Tooltip content="Redo"> | ||
<IconButton icon="redo" /> | ||
</Tooltip> | ||
|
||
<Spacer static /> | ||
|
||
<StudentSummaryBar student={student} /> | ||
|
||
<Spacer flex /> | ||
|
||
<SearchInput placeholder="Find a course" /> | ||
|
||
<Spacer flex /> | ||
|
||
<Tooltip content="Share student"> | ||
<IconButton icon="share" /> | ||
</Tooltip> | ||
</Container> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.