-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
b25fb8a
commit aff20cf
Showing
27 changed files
with
236 additions
and
166 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
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,45 @@ | ||
import { ListItemCounter } from "./ListItemCounter"; | ||
import { ListItemTitle } from "./ListItemTitle"; | ||
import { ListItemDescription } from "./ListItemDescription"; | ||
import { FlagIcon } from "./FlagIcon"; | ||
import { View } from "react-native"; | ||
import { ListItem } from "./ListItem"; | ||
import { Theme } from "../theme"; | ||
import { ListItemTime } from "./ListItemTime"; | ||
import { Result } from "../types"; | ||
|
||
export type Props = { | ||
result: Result; | ||
}; | ||
|
||
export const ListItemResult = ({ result }: Props) => { | ||
return ( | ||
<ListItem> | ||
<View | ||
style={{ | ||
flex: 1, | ||
flexDirection: "row", | ||
justifyContent: "space-between", | ||
alignItems: "center", | ||
gap: Theme.space.xs, | ||
}} | ||
> | ||
<View style={{ flexDirection: "row", gap: Theme.space.xs }}> | ||
<View style={{ flexDirection: "row", alignItems: "center" }}> | ||
<ListItemCounter value={result.position} /> | ||
<FlagIcon nationality={result.Driver.nationality} /> | ||
</View> | ||
|
||
<View> | ||
<ListItemTitle> | ||
{result.Driver.givenName} {result.Driver.familyName} | ||
</ListItemTitle> | ||
<ListItemDescription>{result.Constructor.name}</ListItemDescription> | ||
</View> | ||
</View> | ||
|
||
<ListItemTime time={result.Time?.time} status={result.status} /> | ||
</View> | ||
</ListItem> | ||
); | ||
}; |
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,30 @@ | ||
import { View } from "react-native"; | ||
import { Text } from "react-native-paper"; | ||
import { Theme } from "../theme"; | ||
|
||
type Props = { | ||
time?: string; | ||
status?: string; | ||
}; | ||
|
||
export const ListItemTime = ({ time, status }: Props) => { | ||
const timeAlternative = status?.includes("Lap") ? status : "DNF"; | ||
|
||
return ( | ||
<View | ||
style={{ | ||
flexDirection: "row", | ||
}} | ||
> | ||
<Text | ||
variant="bodySmall" | ||
style={{ | ||
color: Theme.colors.secondary, | ||
fontFamily: Theme.fonts.special, | ||
}} | ||
> | ||
{time ?? timeAlternative} | ||
</Text> | ||
</View> | ||
); | ||
}; |
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,14 @@ | ||
import moment from "moment-timezone"; | ||
|
||
export const getTimezone = () => moment.tz.guess() | ||
|
||
export const convertToMoment = (date: string, time?: string) => { | ||
return date && time ? moment(`${date} ${time}`) : moment(date); | ||
} | ||
|
||
export const formatDate = (date: string, time?: string) => { | ||
const format = date && time ? "MMM DD[,] HH:mm" : "MMM DD" | ||
const timezone = getTimezone(); | ||
const momentValue = convertToMoment(date, time) | ||
return momentValue.tz(timezone).format(format); | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.