Skip to content

Commit

Permalink
Feat/chaingpt (#148)
Browse files Browse the repository at this point in the history
* feat: 🎸 chaingpt demo

* refactor: 💡 move chainGPT to src/theme; upgrade to 0.1.1

* ci: 🎡 update chaingpt-component

* feat: 🎸 chaingpt/api/chat -> /api/chaingpt

* style: 💄 BackToTopButton move to center

* ci: 🎡 update chaingpt-component -> 0.1.5
  • Loading branch information
hzz780 authored Jul 24, 2024
1 parent 816dbb0 commit 5b911be
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@docusaurus/core": "3.4.0",
"@docusaurus/preset-classic": "3.4.0",
"@mdx-js/react": "^3.0.0",
"chaingpt-component": "^0.1.2",
"chaingpt-component": "^0.1.5",
"clsx": "^2.0.0",
"docusaurus-theme-search-typesense": "^0.20.0-0",
"dotenv": "^16.4.5",
Expand Down
28 changes: 28 additions & 0 deletions src/theme/BackToTopButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import clsx from 'clsx';
import {translate} from '@docusaurus/Translate';
import {ThemeClassNames} from '@docusaurus/theme-common';
import {useBackToTopButton} from '@docusaurus/theme-common/internal';

import styles from './styles.module.css';

export default function BackToTopButton(): JSX.Element {
const {shown, scrollToTop} = useBackToTopButton({threshold: 300});
return (
<button
aria-label={translate({
id: 'theme.BackToTopButton.buttonAriaLabel',
message: 'Scroll back to top',
description: 'The ARIA label for the back to top button',
})}
className={clsx(
'clean-btn',
ThemeClassNames.common.backToTopButton,
styles.backToTopButton,
shown && styles.backToTopButtonShow,
)}
type="button"
onClick={scrollToTop}
/>
);
}
39 changes: 39 additions & 0 deletions src/theme/BackToTopButton/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.backToTopButton {
position: fixed;
left: 0;
right: 0;
margin: auto;
bottom: 1.3rem;
border-radius: 50%;
background-color: var(--ifm-color-emphasis-200);
width: 3rem;
height: 3rem;
z-index: calc(var(--ifm-z-index-fixed) - 1);
box-shadow: var(--ifm-global-shadow-lw);
transition: all var(--ifm-transition-fast)
var(--ifm-transition-timing-default);
opacity: 0;
transform: scale(0);
visibility: hidden;
}

.backToTopButton::after {
content: ' ';
display: inline-block;
mask: var(--ifm-menu-link-sublist-icon) 50% / 2rem 2rem no-repeat;
background-color: var(--ifm-color-emphasis-1000);
width: 100%;
height: 100%;
}

@media (hover: hover) {
.backToTopButton:hover {
background-color: var(--ifm-color-emphasis-300);
}
}

.backToTopButtonShow {
opacity: 1;
transform: scale(1);
visibility: visible;
}
1 change: 1 addition & 0 deletions src/theme/ChainGPT/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
display: flex;
flex-direction: column;
align-items: end;
z-index: 999;
}

0 comments on commit 5b911be

Please sign in to comment.