-
-
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
add0de8
commit ab1b9da
Showing
7 changed files
with
123 additions
and
25 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,8 @@ | ||
--- | ||
nav: components | ||
group: shields | ||
title: Bilibili | ||
order: 6 | ||
--- | ||
|
||
<code src="./index.tsx" inline></code> |
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 { useControls, useCreateStore } from '@lobehub/ui'; | ||
import { LevaInputs, folder } from 'leva'; | ||
import { pick } from 'lodash-es'; | ||
import { memo, useMemo } from 'react'; | ||
|
||
import MarkdownStorybook from '@/components/MarkdownStorybook'; | ||
import { shieldBaseControls } from '@/const/shieldBaseControls'; | ||
import { genBilibiliShield } from '@/services/genCustomShield'; | ||
|
||
const controls = { | ||
/* eslint-disable sort-keys-fix/sort-keys-fix */ | ||
uid: { | ||
value: '410372', | ||
type: LevaInputs.STRING, | ||
}, | ||
label: 'followers', | ||
['⚒️']: folder( | ||
{ | ||
...pick(shieldBaseControls, ['style']), | ||
labelColor: { | ||
...shieldBaseControls.labelColor, | ||
value: 'black', | ||
}, | ||
color: { | ||
...shieldBaseControls.labelColor, | ||
value: 'fb7299', | ||
}, | ||
logoColor: { | ||
...shieldBaseControls.logoColor, | ||
value: 'white', | ||
}, | ||
}, | ||
{ | ||
collapsed: true, | ||
}, | ||
), | ||
/* eslint-enable */ | ||
}; | ||
|
||
const Bilibili = memo(() => { | ||
const store = useCreateStore(); | ||
|
||
const options = useControls(controls, { store }); | ||
|
||
const md = useMemo(() => genBilibiliShield(options as any), [options]); | ||
|
||
return <MarkdownStorybook levaStore={store}>{md.join('\n\n')}</MarkdownStorybook>; | ||
}); | ||
|
||
export default Bilibili; |
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