-
Notifications
You must be signed in to change notification settings - Fork 13
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
liningzhu
committed
Jan 22, 2024
1 parent
54049a5
commit 79c6e59
Showing
28 changed files
with
178 additions
and
78 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
20 changes: 20 additions & 0 deletions
20
packages/buitar/src/components/fixed-btn/info-btn.module.scss
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,20 @@ | ||
.pages-intro { | ||
opacity: 0.7; | ||
padding: $space-16; | ||
max-height: 64vh; | ||
overflow-y: scroll; | ||
|
||
h2 { | ||
letter-spacing: 0.5px; | ||
font-weight: 500; | ||
font-size: 32px; | ||
margin: 0 0 $space-16; | ||
} | ||
|
||
p { | ||
margin: 10px 0px; | ||
font-weight: 300; | ||
font-size: 18px; | ||
text-align: justify; | ||
} | ||
} |
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,47 @@ | ||
import { FC, memo, useState, useCallback } from 'react' | ||
import { Icon, Modal } from '@/components' | ||
import { pagesIntroConfig } from '@/pages/pages.config' | ||
import { useRouteMatch } from '@/utils/hooks/use-routers' | ||
import styles from './info-btn.module.scss' | ||
|
||
export const InfoBtn: FC<React.HTMLAttributes<HTMLButtonElement>> = memo((props) => { | ||
const curRoute = useRouteMatch() | ||
const [infoModalVisible, setInfoModalVisible] = useState<boolean>(false) | ||
|
||
const toggleInfoModalVisible = useCallback(() => { | ||
setInfoModalVisible(!infoModalVisible) | ||
}, [infoModalVisible]) | ||
|
||
if (!curRoute?.id) { | ||
return null | ||
} | ||
|
||
const pageInfo = pagesIntroConfig.get(curRoute.id) | ||
|
||
if (!pageInfo) { | ||
return null | ||
} | ||
const { title, content } = pageInfo | ||
|
||
return ( | ||
<button id="info-btn" className={props.className}> | ||
<Icon | ||
name="icon-more" | ||
style={{ transform: 'rotate(90deg)' }} | ||
onClick={toggleInfoModalVisible} | ||
></Icon> | ||
<Modal | ||
visible={infoModalVisible} | ||
onCancel={toggleInfoModalVisible} | ||
onConfirm={toggleInfoModalVisible} | ||
> | ||
<section className={styles['pages-intro']}> | ||
<h2>{title}</h2> | ||
{content.map((item, index) => ( | ||
<p key={index}>{item}</p> | ||
))} | ||
</section> | ||
</Modal> | ||
</button> | ||
) | ||
}) |
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
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
display: flex; | ||
align-items: center; | ||
cursor: pointer; | ||
opacity: 0.8; | ||
|
||
> h2 { | ||
margin: $font-16 $font-10; | ||
|
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
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
Oops, something went wrong.