-
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
9 changed files
with
2,740 additions
and
467 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
'use client' | ||
import MarkdownScreen from '@app/core/screens/MarkdownScreen' | ||
|
||
export default MarkdownScreen |
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,90 @@ | ||
import React from 'react' | ||
import { StyleSheet, View, Text } from 'react-native' | ||
import { MDXStyles, MDXComponents } from '@bacons/mdx' | ||
import { Link } from '../navigation/Link' | ||
import './markdown.theme.css' // Duplicate of the React-Native styles from this file | ||
|
||
/* --- Types -------------------------------------------------------------------------------------- */ | ||
|
||
type MarkdownScreenProps = { | ||
children: React.ReactNode | ||
} | ||
|
||
/* --- <MarkdownTheme/> --------------------------------------------------------------------------- */ | ||
|
||
const MarkdownTheme = ({ children }: MarkdownScreenProps) => { | ||
return ( | ||
<View nativeID="markdown-theme"> | ||
<MDXStyles | ||
h1={styles.h1} | ||
h2={styles.h2} | ||
p={styles.p} | ||
ul={styles.ul} | ||
li={styles.li} | ||
blockquote={styles.blockquote} | ||
a={styles.link} | ||
> | ||
<MDXComponents | ||
h1={(props) => <Text {...props} style={{ ...styles.h1 }} />} | ||
h2={(props) => <Text {...props} style={{ ...styles.h2 }} />} | ||
p={(props) => <Text {...props} style={{ ...styles.p }} />} | ||
ul={(props) => <View {...props} style={{ ...styles.ul }} />} | ||
li={(props) => <Text {...props} style={{ ...styles.li }} />} | ||
blockquote={(props) => <View {...props} style={{ ...styles.blockquote }} />} // prettier-ignore | ||
a={(props) => <Link {...props} style={{ ...styles.link }} />} | ||
> | ||
{children} | ||
</MDXComponents> | ||
</MDXStyles> | ||
</View> | ||
) | ||
} | ||
|
||
/* --- Styles ---------------------------------------------------------------------------------- */ | ||
// -i- These styles won't work in Next.js for some reason, duplicate them in markdown.theme.css | ||
|
||
const styles = StyleSheet.create({ | ||
h1: { | ||
fontSize: 24, | ||
fontWeight: 'bold', | ||
marginBottom: 16, | ||
}, | ||
h2: { | ||
fontSize: 20, | ||
fontWeight: 'bold', | ||
marginBottom: 16, | ||
}, | ||
p: { | ||
fontSize: 16, | ||
marginBottom: 16, | ||
lineHeight: 22, | ||
}, | ||
ul: { | ||
padding: 0, | ||
}, | ||
li: { | ||
fontSize: 16, | ||
marginBottom: 16, | ||
lineHeight: 22, | ||
}, | ||
blockquote: { | ||
borderLeftColor: 'lightgray', | ||
borderStyle: 'solid', | ||
borderLeftWidth: 6, | ||
fontSize: 16, | ||
paddingLeft: 16, | ||
paddingTop: 4, | ||
lineHeight: 22, | ||
}, | ||
link: { | ||
marginTop: 16, | ||
fontSize: 16, | ||
color: 'blue', | ||
textAlign: 'center', | ||
textDecorationLine: 'underline', | ||
}, | ||
}) | ||
|
||
/* --- Exports --------------------------------------------------------------------------------- */ | ||
|
||
export default MarkdownTheme |
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,62 @@ | ||
|
||
/* --- Resets ---------------------------------------------------------------------------------- */ | ||
|
||
ul { | ||
padding-inline-start: 0px; | ||
list-style: none; | ||
} | ||
|
||
blockquote { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
/* --- Markdown theme -------------------------------------------------------------------------- */ | ||
/* -i- duplicate from 'MarkdownTheme.tsx', keep them in sync */ | ||
|
||
#markdown-theme h1 { | ||
font-size: 24px; | ||
font-weight: bold; | ||
margin-bottom: 16px; | ||
} | ||
|
||
#markdown-theme h2 { | ||
font-size: 20px; | ||
font-weight: bold; | ||
margin-bottom: 16px; | ||
} | ||
|
||
#markdown-theme p { | ||
font-size: 16px; | ||
margin-bottom: 16px; | ||
line-height: 22px; | ||
} | ||
|
||
#markdown-theme ul { | ||
padding: 0; | ||
} | ||
|
||
#markdown-theme li { | ||
font-size: 16px; | ||
margin-bottom: 16px; | ||
line-height: 22px; | ||
} | ||
|
||
#markdown-theme blockquote { | ||
border-width: 0; | ||
border-style: solid; | ||
border-left-color: lightgray; | ||
border-left-width: 6px; | ||
font-size: 16px; | ||
padding-left: 16px; | ||
padding-top: 4px; | ||
line-height: 22px; | ||
} | ||
|
||
#markdown-theme a { | ||
margin-top: 16px; | ||
font-size: 16px; | ||
color: blue; | ||
text-align: center; | ||
text-decoration: underline; | ||
} |
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
Oops, something went wrong.