-
Notifications
You must be signed in to change notification settings - Fork 1
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
21 changed files
with
358 additions
and
207 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ const s = StyleSheet.create({ | |
fontSize: 21, | ||
}, | ||
xl: { | ||
fontSize: 24, | ||
fontSize: 20, | ||
}, | ||
}); | ||
|
||
|
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,80 @@ | ||
import React, { FC } from 'react'; | ||
import { useColorScheme } from 'react-native'; | ||
import { | ||
ThemeProvider as ReThemeProvider, | ||
createBox, | ||
createText, | ||
createTheme, | ||
useTheme as useThemeRN, | ||
} from '@shopify/restyle'; | ||
import { dark, light } from 'types/colors'; | ||
|
||
export const palette = { | ||
purple: '#5A31F4', | ||
white: '#FFF', | ||
black: '#111', | ||
darkGray: '#333', | ||
lightGray: '#EEE', | ||
}; | ||
|
||
export const theme = createTheme({ | ||
spacing: { | ||
1: 8, | ||
2: 16, | ||
3: 24, | ||
4: 32, | ||
}, | ||
colors: light, | ||
breakpoints: {}, | ||
textVariants: { | ||
title: { | ||
fontSize: 20, | ||
lineHeight: 24, | ||
color: 'PrimaryText', | ||
}, | ||
body: { | ||
fontSize: 16, | ||
color: 'PrimaryText', | ||
}, | ||
empty: { | ||
fontSize: 16, | ||
color: 'Empty', | ||
}, | ||
small: { | ||
fontSize: 12, | ||
lineHeight: 16, | ||
color: 'SecondaryText', | ||
}, | ||
}, | ||
cardVariants: { | ||
primary: { | ||
backgroundColor: 'primaryCardBackground', | ||
shadowOpacity: 0.3, | ||
}, | ||
secondary: { | ||
backgroundColor: 'secondaryCardBackground', | ||
shadowOpacity: 0.1, | ||
}, | ||
}, | ||
}); | ||
|
||
type Theme = typeof theme; | ||
|
||
const darkTheme: Theme = { | ||
...theme, | ||
colors: { | ||
...theme.colors, | ||
...dark, | ||
}, | ||
}; | ||
|
||
export const Box = createBox<Theme>(); | ||
export const Text = createText<Theme>(); | ||
|
||
export const ThemeProvider: FC = ({ children }) => { | ||
const currentMode = useColorScheme(); | ||
|
||
return <ReThemeProvider theme={currentMode === 'dark' ? darkTheme : theme}>{children}</ReThemeProvider>; | ||
}; | ||
|
||
export const useTheme = () => useThemeRN<Theme>(); |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { FC } from 'react'; | ||
import { Carousel } from 'components'; | ||
import { currentBooksQuery } from '../home.queries'; | ||
import { NowReadingBook } from './now-reading-book'; | ||
import { EmptyBook } from './empty-book'; | ||
import { Dimensions } from 'react-native'; | ||
import { useObservable } from 'utils/use-observable'; | ||
|
||
const PADDINGS = 48; | ||
|
||
function getCurrentBooks() { | ||
return currentBooksQuery().observeWithColumns(['thumbnail']); | ||
} | ||
|
||
export const CurrentBook: FC = () => { | ||
const books = useObservable(getCurrentBooks, null, []); | ||
const width = Dimensions.get('screen').width; | ||
|
||
if (!books) return null; | ||
if (!books.length) return <EmptyBook />; | ||
|
||
return ( | ||
<Carousel width={width - PADDINGS}> | ||
{books.map(book => <NowReadingBook key={book.id} book={book} />).concat(<EmptyBook key='empty' />)} | ||
</Carousel> | ||
); | ||
}; |
Oops, something went wrong.