-
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.
Add dummy data and refactor tiles bansed on new structure, add base t…
…iles ready for development
- Loading branch information
Graeme Houston
committed
Aug 27, 2024
1 parent
0a00439
commit d9610d8
Showing
44 changed files
with
2,436 additions
and
395 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
15 changes: 15 additions & 0 deletions
15
lib/components/atoms/LoadingIndicator/LoadingIndicator.stories.tsx
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,15 @@ | ||
import React from 'react'; | ||
import { StoryFn, Meta } from '@storybook/react'; | ||
import LoadingIndicator from './index'; | ||
|
||
export default { | ||
title: 'components/atoms/LoadingIndicator', | ||
component: LoadingIndicator, | ||
} as Meta; | ||
|
||
const Template: StoryFn = (args) => <LoadingIndicator {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
// Add default props here | ||
}; |
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,39 @@ | ||
import { useTheme } from "@/context/ThemeContext"; | ||
import React from "react"; | ||
import { ActivityIndicator, StyleSheet, View } from "react-native"; | ||
|
||
type LoadingIndicatorProps = { | ||
// Define your props here | ||
}; | ||
|
||
const LoadingIndicator: React.FC<LoadingIndicatorProps> = () => { | ||
const { theme } = useTheme(); | ||
|
||
return ( | ||
<View | ||
style={[ | ||
styles.container, | ||
{ | ||
backgroundColor: theme.surface, | ||
borderRadius: theme.sizes.borderRadius, | ||
padding: theme.sizes.md, | ||
}, | ||
]} | ||
> | ||
<ActivityIndicator size="small" color={theme.primary} /> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
width: "100%", | ||
height: "100%", | ||
overflow: "hidden", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
position: "relative", | ||
}, | ||
}); | ||
|
||
export default LoadingIndicator; |
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,15 @@ | ||
import { Meta, StoryFn } from "@storybook/react"; | ||
import React from "react"; | ||
import Tile from "./index"; | ||
|
||
export default { | ||
title: "components/atoms/Tile", | ||
component: Tile, | ||
} as Meta; | ||
|
||
const Template: StoryFn<typeof Tile> = (args) => <Tile {...args} />; | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
// Add default props here | ||
}; |
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,50 @@ | ||
import { useSectionContext } from "@/components/organisms/Section"; | ||
import { useTheme } from "@/context/ThemeContext"; | ||
import Color from "color"; | ||
import React from "react"; | ||
import { StyleSheet, View } from "react-native"; | ||
import LoadingIndicator from "../LoadingIndicator"; | ||
|
||
type TileProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
const Tile: React.FC<TileProps> = ({ children }) => { | ||
const { loading: isLoading } = useSectionContext(); | ||
const { theme } = useTheme(); | ||
|
||
return ( | ||
<View | ||
style={[ | ||
styles.container, | ||
{ | ||
backgroundColor: theme.surface, | ||
borderColor: Color(theme.surface).darken(0.02).string(), | ||
borderRadius: theme.sizes.borderRadius, | ||
}, | ||
]} | ||
> | ||
{isLoading ? <LoadingIndicator /> : children} | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
width: "100%", | ||
height: "100%", | ||
overflow: "hidden", | ||
alignItems: "flex-start", | ||
justifyContent: "center", | ||
position: "relative", | ||
maxWidth: 270, | ||
borderWidth: 1, | ||
aspectRatio: 1, | ||
// shadowColor: "#AAAAAA", | ||
// shadowOffset: { width: 0, height: 2 }, | ||
// shadowOpacity: 0.25, | ||
// shadowRadius: 3, | ||
}, | ||
}); | ||
|
||
export default Tile; |
Oops, something went wrong.