-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
873da2c
commit 05cd99b
Showing
21 changed files
with
3,151 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { writeFileSync } from 'node:fs'; | ||
import { resolve } from 'node:path'; | ||
import { getIconsData, titleToSlug } from 'simple-icons/sdk'; | ||
|
||
const runIconSync = async () => { | ||
const data = await getIconsData(); | ||
const list = data.map((icon) => titleToSlug(icon.title)); | ||
writeFileSync( | ||
resolve('./src/const/icons.ts'), | ||
`export default ${JSON.stringify(Array.from(new Set(list.filter(Boolean))))} as const`, | ||
'utf8', | ||
); | ||
}; | ||
|
||
runIconSync(); |
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 { memo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import Highlight from '@/components/Highlight'; | ||
import Markdown from '@/components/Markdown'; | ||
|
||
import { useStyles } from './style'; | ||
|
||
const MarkdownEditor = memo<{ children: string }>(({ children }) => { | ||
const { styles } = useStyles(); | ||
|
||
return ( | ||
<Flexbox className={styles.container}> | ||
<Markdown className={styles.markdown}>{children}</Markdown>; | ||
<Highlight className={styles.preview} language={'md'} type={'pure'}> | ||
{children} | ||
</Highlight> | ||
</Flexbox> | ||
); | ||
}); | ||
|
||
export default MarkdownEditor; |
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 { createStyles } from 'antd-style'; | ||
|
||
export const useStyles = createStyles(({ css, token }) => { | ||
return { | ||
container: css` | ||
position: relative; | ||
overflow: hidden; | ||
width: 100%; | ||
height: 100%; | ||
`, | ||
markdown: css` | ||
overflow: hidden; | ||
flex: 1; | ||
height: 100%; | ||
border-bottom: 1px solid ${token.colorBorder}; | ||
`, | ||
preview: css` | ||
flex: 1; | ||
border-radius: 0; | ||
`, | ||
}; | ||
}); |
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 { StroyBook, StroyBookProps } from '@lobehub/ui'; | ||
import { memo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import Highlight from '@/components/Highlight'; | ||
import Markdown from '@/components/Markdown'; | ||
|
||
import { useStyles } from './style'; | ||
|
||
const MarkdownEditor = memo<{ children: string; levaStore: StroyBookProps['levaStore'] }>( | ||
({ children, levaStore }) => { | ||
const { styles } = useStyles(); | ||
|
||
return ( | ||
<Flexbox className={styles.container}> | ||
<StroyBook levaStore={levaStore} noPadding> | ||
<Markdown className={styles.markdown}>{children}</Markdown> | ||
</StroyBook> | ||
<Highlight className={styles.preview} fullFeatured language={'md'} type={'pure'}> | ||
{children} | ||
</Highlight> | ||
</Flexbox> | ||
); | ||
}, | ||
); | ||
|
||
export default MarkdownEditor; |
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,26 @@ | ||
import { createStyles } from 'antd-style'; | ||
|
||
export const useStyles = createStyles(({ css, token }) => { | ||
return { | ||
container: css` | ||
position: relative; | ||
overflow: hidden; | ||
width: 100%; | ||
border-radius: ${token.borderRadiusLG}px; | ||
box-shadow: 0 0 0 1px ${token.colorBorder}; | ||
`, | ||
markdown: css` | ||
overflow-x: hidden; | ||
overflow-y: auto; | ||
width: 100%; | ||
height: 100%; | ||
`, | ||
preview: css` | ||
border-top: 1px solid ${token.colorBorder}; | ||
border-radius: 0; | ||
`, | ||
}; | ||
}); |
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,17 @@ | ||
import { Highlighter, HighlighterProps } from '@lobehub/ui'; | ||
import { memo } from 'react'; | ||
import useSWR from 'swr'; | ||
|
||
import { remarkFormat } from '@/utils/remarkFormat'; | ||
|
||
const Highlight = memo<HighlighterProps>(({ children, ...props }) => { | ||
const { data, isLoading } = useSWR(children, () => remarkFormat(children)); | ||
|
||
return ( | ||
<Highlighter {...props} language={'md'} type={'pure'}> | ||
{isLoading ? '' : String(data)} | ||
</Highlighter> | ||
); | ||
}); | ||
|
||
export default Highlight; |
Oops, something went wrong.