-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: dark & light image component * chore: update pr template * chore: fix icon colors in dark mode
- Loading branch information
1 parent
a84116e
commit d39f888
Showing
9 changed files
with
51 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import useBaseUrl from '@docusaurus/useBaseUrl'; | ||
import { useColorMode } from '@docusaurus/theme-common'; | ||
|
||
type ImageProps = { | ||
lightImage: string; | ||
darkImage: string; | ||
alt: string; | ||
[key: string]: any; | ||
}; | ||
|
||
const Image: React.FC<ImageProps> = ({ lightImage, darkImage, alt, ...props }) => { | ||
const { colorMode } = useColorMode(); | ||
|
||
const imageUrl = colorMode === 'dark' ? darkImage : lightImage; | ||
|
||
return <img src={useBaseUrl(imageUrl)} alt={alt} {...props} />; | ||
}; | ||
|
||
export default Image; |
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
Binary file not shown.
Binary file not shown.