-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from FedeMadoery/master
- Loading branch information
Showing
20 changed files
with
586 additions
and
157 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,12 +1,77 @@ | ||
import { connect } from 'react-redux'; | ||
import moment from 'moment'; | ||
import React from 'react'; | ||
|
||
export default class DayBlock extends React.Component { | ||
import Flex from './Flex'; | ||
import Text from './Text'; | ||
import Card from './Card'; | ||
|
||
class DayBlock extends React.Component { | ||
|
||
renderTinySetBlocks = (setBlocks, day) => { | ||
const blockDay = moment(day).format('YYYY-MM-DD') | ||
const setBlocksByDate = _.groupBy(setBlocks, 'date') | ||
const setBlocksToRender = setBlocksByDate[blockDay] || []; | ||
|
||
return setBlocksToRender.map( setBlock => ( | ||
<Card | ||
key={setBlock.id} | ||
height='8px' | ||
width='5px' | ||
borderBottom={setBlock.blockFraction === 1.0 ? '' : '4px lightGrey solid'} | ||
bg='red' | ||
my='0.3rem' | ||
mr='0.3rem' | ||
> | ||
</Card> | ||
)) | ||
} | ||
|
||
render() { | ||
const { day, selected, onClick, currentTeamMember, fetchingData } = this.props | ||
|
||
return ( | ||
<div className='DayBlock'> | ||
<h6>DayBlock</h6> | ||
</div> | ||
<Flex | ||
column | ||
center | ||
className='DayBlock' | ||
mx='0.5rem' | ||
> | ||
<Card | ||
width='100%' | ||
bg='white' | ||
borderLeft={selected ? '2px solid red' : '2px solid white'} | ||
depth={9} | ||
mx='0.5rem' | ||
onClick={() => onClick(day)} | ||
> | ||
<Flex row center> | ||
<Flex column> | ||
{ // If you are waiting for the API to respond, it does not render | ||
!fetchingData && this.renderTinySetBlocks(currentTeamMember.weeklySetblocks, day) | ||
} | ||
</Flex> | ||
<Flex column> | ||
<Text align='center' mb='0rem' color={selected ? 'red' : 'textSecondary'}> | ||
{day.getDate()} | ||
</Text> | ||
<Text align='center' mt='0rem' color={selected ? 'red' : 'textSecondary'}> | ||
{day.toDateString().slice(0, 3)} | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
</Card> | ||
</Flex> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = ({ environment }) => { | ||
return { | ||
...environment | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = { | ||
}; | ||
export default connect(mapStateToProps, mapDispatchToProps)(DayBlock) |
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,34 @@ | ||
import React, { Component } from 'react'; | ||
import styled, { keyframes } from 'styled-components'; | ||
|
||
const BounceAnimation = keyframes` | ||
0% { margin-bottom: 0; } | ||
50% { margin-bottom: 5px } | ||
100% { margin-bottom: 0 } | ||
`; | ||
const DotWrapper = styled.div` | ||
display: flex; | ||
align-items: flex-end; | ||
`; | ||
const Dot = styled.div` | ||
background-color: rgb(46,73,122); | ||
border-radius: 50%; | ||
width: 4px; | ||
height: 4px; | ||
margin: 0 3px; | ||
/* Animation */ | ||
animation: ${BounceAnimation} 0.5s linear infinite; | ||
animation-delay: ${props => props.delay}; | ||
`; | ||
|
||
export default class LoadingDots extends Component { | ||
render() { | ||
return ( | ||
<DotWrapper> | ||
<Dot delay='0s' /> | ||
<Dot delay='.1s' /> | ||
<Dot delay='.2s' /> | ||
</DotWrapper> | ||
) | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,12 +1,35 @@ | ||
import React from 'react'; | ||
import moment from 'moment'; | ||
|
||
import Text from './Text'; | ||
import Card from './Card'; | ||
import Flex from './Flex'; | ||
|
||
|
||
export default class ScheduleHeader extends React.Component { | ||
render() { | ||
const { selectedDay } = this.props; | ||
return ( | ||
<div className='ScheduleHeader'> | ||
<h6>ScheduleHeader</h6> | ||
</div> | ||
<Flex | ||
row | ||
className='ScheduleHeader' | ||
> | ||
<Card | ||
width='10px' | ||
height='10px' | ||
bg='green' | ||
borderRadius={50} | ||
my='auto' | ||
mx='1rem' | ||
/> | ||
<Text | ||
weight='600' | ||
align='center' | ||
color='textSecondary' | ||
> | ||
{moment(selectedDay).format('dddd, MMMM D, YYYY')} | ||
</Text> | ||
</Flex> | ||
); | ||
} | ||
} | ||
|
Oops, something went wrong.