-
Notifications
You must be signed in to change notification settings - Fork 5
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 #301 from digitalfabrik/LUN-328-implement-new-desi…
…gn-for-home-screen LUN-328: Implement new design for home screen
- Loading branch information
Showing
19 changed files
with
301 additions
and
115 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,22 @@ | ||
import { NextExerciseData } from '../constants/data' | ||
import { Discipline } from '../constants/endpoints' | ||
import { getNextExercise, loadTrainingsSet } from '../services/helpers' | ||
import { formatDiscipline } from './helpers' | ||
import useLoadAsync, { Return } from './useLoadAsync' | ||
import { loadDocuments } from './useLoadDocuments' | ||
|
||
export const loadNextExercise = async (profession: Discipline): Promise<NextExerciseData> => { | ||
const nextExercise = await getNextExercise(profession) | ||
const trainingSet = await loadTrainingsSet(nextExercise.disciplineId) | ||
const documents = await loadDocuments({ disciplineId: nextExercise.disciplineId }) | ||
return { | ||
documents, | ||
title: formatDiscipline(trainingSet, { parent: null }).title, | ||
exerciseKey: nextExercise.exerciseKey, | ||
disciplineId: nextExercise.disciplineId | ||
} | ||
} | ||
|
||
const useLoadNextExercise = (loadData: Discipline): Return<NextExerciseData> => useLoadAsync(loadNextExercise, loadData) | ||
|
||
export default useLoadNextExercise |
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
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
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,79 @@ | ||
import React, { ReactElement } from 'react' | ||
import { Pressable, TouchableOpacity } from 'react-native' | ||
import { widthPercentageToDP as wp } from 'react-native-responsive-screen' | ||
import styled from 'styled-components/native' | ||
|
||
import { ArrowRightCircleIconWhite } from '../../../../assets/images' | ||
import { ContentTextLight } from '../../../components/text/Content' | ||
import { SubheadingPrimary, SubheadingText } from '../../../components/text/Subheading' | ||
|
||
const Container = styled.View` | ||
flex-direction: row; | ||
background-color: ${props => props.theme.colors.background}; | ||
padding: ${props => props.theme.spacings.sm}; | ||
margin: ${props => props.theme.spacings.sm} 0; | ||
shadow-color: ${props => props.theme.colors.shadow}; | ||
elevation: 8; | ||
shadow-radius: 1px; | ||
shadow-offset: 1px 1px; | ||
shadow-opacity: 0.5; | ||
` | ||
|
||
const ExerciseDetail = styled.View` | ||
padding: 0 ${props => props.theme.spacings.sm}; | ||
align-self: center; | ||
` | ||
|
||
const ActionContainer = styled.View` | ||
padding-top: ${props => props.theme.spacings.xs}; | ||
flex-direction: row; | ||
align-items: flex-start; | ||
` | ||
|
||
const Label = styled(SubheadingPrimary)` | ||
letter-spacing: ${props => props.theme.fonts.capsLetterSpacing}; | ||
text-transform: uppercase; | ||
padding-right: ${props => props.theme.spacings.xs}; | ||
align-self: center; | ||
` | ||
|
||
const Thumbnail = styled.Image` | ||
height: ${wp('19%')}px; | ||
width: ${wp('18%')}px; | ||
align-self: center; | ||
` | ||
|
||
const Heading = styled(SubheadingText)` | ||
font-size: ${props => props.theme.fonts.smallFontSize}; | ||
` | ||
const Subheading = styled(ContentTextLight)` | ||
font-size: ${props => props.theme.fonts.smallFontSize}; | ||
` | ||
|
||
interface PropsType { | ||
thumbnail: string | ||
heading: string | ||
subheading: string | ||
buttonLabel: string | ||
onPress: () => void | ||
} | ||
|
||
const NextExerciseCard = ({ thumbnail, onPress, heading, subheading, buttonLabel }: PropsType): ReactElement => ( | ||
<Pressable onPress={onPress}> | ||
<Container> | ||
<Thumbnail source={{ uri: thumbnail }} /> | ||
<ExerciseDetail> | ||
<Heading>{heading}</Heading> | ||
<Subheading>{subheading}</Subheading> | ||
<ActionContainer> | ||
<TouchableOpacity style={{ flexDirection: 'row' }} onPress={onPress}> | ||
<Label>{buttonLabel}</Label> | ||
<ArrowRightCircleIconWhite width={wp('8%')} height={wp('8%')} /> | ||
</TouchableOpacity> | ||
</ActionContainer> | ||
</ExerciseDetail> | ||
</Container> | ||
</Pressable> | ||
) | ||
|
||
export default NextExerciseCard |
Oops, something went wrong.