generated from shuding/nextra-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devrel' into feature/for-devs-docs
- Loading branch information
Showing
27 changed files
with
1,273 additions
and
274 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,59 @@ | ||
// components/BrandKitGallery/BrandImage.tsx | ||
import NextImage from 'next/image'; | ||
import styles from '../../styles/custom.module.css'; | ||
import { useState, useEffect } from 'react'; | ||
|
||
interface BrandImageProps { | ||
url: string; | ||
alt: string; | ||
name: string; | ||
} | ||
|
||
const BrandImage = ({ url, alt, name }: BrandImageProps) => { | ||
const [imageDimensions, setImageDimensions] = useState({ width: 0, height: 0 }); | ||
const [showModal, setShowModal] = useState(false); | ||
|
||
useEffect(() => { | ||
const img = new window.Image(); | ||
img.src = url; | ||
img.onload = () => { | ||
setImageDimensions({ width: img.width, height: img.height }); | ||
}; | ||
}, [url]); | ||
|
||
const handleImageClick = () => { | ||
setShowModal(true); | ||
document.body.style.overflow = 'hidden'; | ||
}; | ||
|
||
const closeModal = () => { | ||
setShowModal(false); | ||
document.body.style.overflow = 'auto'; | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className={styles.imageWrapper}> | ||
<div className={styles.imageContainer}> | ||
<NextImage | ||
src={url} | ||
alt={alt} | ||
width={imageDimensions.width} | ||
height={imageDimensions.height} | ||
className={styles.image} | ||
onClick={handleImageClick} | ||
/> | ||
</div> | ||
</div> | ||
{showModal && ( | ||
<div className={styles.modal} onClick={closeModal}> | ||
<div className={styles.modalContent}> | ||
<NextImage src={url} alt={alt} layout="fill" objectFit="contain" /> | ||
</div> | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default BrandImage; |
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 @@ | ||
// components/BrandKitGallery/DownloadButton.tsx | ||
import React from 'react'; | ||
import styles from '../../styles/custom.module.css'; | ||
|
||
const DownloadButton = ({ url, fileName, children }) => { | ||
const handleDownload = () => { | ||
const link = document.createElement('a'); | ||
link.href = url; | ||
link.setAttribute('download', fileName); | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
}; | ||
|
||
return ( | ||
<button className={styles.downloadButton} onClick={handleDownload}> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default DownloadButton; |
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,2 @@ | ||
export { default as BrandImage } from './BrandImage'; | ||
export { default as DownloadButton } from './DownloadButton'; |
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,73 @@ | ||
// components/EvmWalletConnect/CustomConnectButton.tsx | ||
import { ConnectButton } from "@rainbow-me/rainbowkit"; | ||
import styled from 'styled-components'; | ||
|
||
const CustomButton = styled.button` | ||
background: #001B2A; /* Dark color */ | ||
border: none; | ||
color: #ECDEDE; /* Light color */ | ||
padding: 0.5rem 1rem; | ||
font-size: 1rem; | ||
cursor: pointer; | ||
transition: color 0.3s, background 0.3s; | ||
display: inline-block; | ||
margin-top: 1rem; | ||
margin-right: 0.5rem; | ||
border-radius: 25px; /* Rounded corners */ | ||
text-align: center; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
font-family: 'Inter', sans-serif; | ||
&:hover { | ||
color: #001B2A; /* Dark color */ | ||
background: #ECDEDE; /* Light color */ | ||
} | ||
`; | ||
|
||
const CustomConnectButton = (props) => ( | ||
<ConnectButton.Custom> | ||
{({ account, chain, openAccountModal, openConnectModal, openChainModal, mounted }) => { | ||
const ready = mounted; | ||
const connected = ready && account && chain; | ||
|
||
return ( | ||
<div | ||
{...(!ready && { | ||
'aria-hidden': true, | ||
'style': { | ||
opacity: 0, | ||
pointerEvents: 'none', | ||
userSelect: 'none' | ||
}, | ||
})} | ||
> | ||
{(() => { | ||
if (!connected) { | ||
return ( | ||
<CustomButton onClick={openConnectModal} type="button"> | ||
Connect Wallet | ||
</CustomButton> | ||
); | ||
} | ||
|
||
if (chain.unsupported) { | ||
return ( | ||
<CustomButton onClick={openChainModal} type="button"> | ||
Wrong network | ||
</CustomButton> | ||
); | ||
} | ||
|
||
return ( | ||
<CustomButton onClick={openAccountModal} type="button"> | ||
{account.displayName} | ||
</CustomButton> | ||
); | ||
})()} | ||
</div> | ||
); | ||
}} | ||
</ConnectButton.Custom> | ||
); | ||
|
||
export default CustomConnectButton; |
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 |
---|---|---|
@@ -1,6 +1,16 @@ | ||
const withNextra = require('nextra')({ | ||
theme: 'nextra-theme-docs', | ||
themeConfig: './theme.config.tsx', | ||
}) | ||
}); | ||
|
||
module.exports = withNextra() | ||
module.exports = withNextra({ | ||
images: { | ||
remotePatterns: [ | ||
{ | ||
protocol: 'https', | ||
hostname: 'cdn.sei.io', | ||
pathname: '**', | ||
} | ||
], | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import '../styles/globals.css' | ||
import '../styles/globals.css'; | ||
import '../styles/custom.css'; | ||
import '@rainbow-me/rainbowkit/styles.css'; | ||
import { ThemeProvider } from 'next-themes'; | ||
|
||
export default function Nextra({ Component, pageProps }) { | ||
return ( | ||
<> | ||
<Component {...pageProps} /> | ||
</> | ||
) | ||
} | ||
return ( | ||
<ThemeProvider attribute="class"> | ||
<Component {...pageProps} /> | ||
</ThemeProvider> | ||
); | ||
} |
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.