Skip to content

Commit

Permalink
feat: add dark mode for card on home page
Browse files Browse the repository at this point in the history
Closes: #3
  • Loading branch information
gretmn102 committed Jun 19, 2024
1 parent e37b1c8 commit 944e5f3
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
1 change: 1 addition & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const config: Config = {
logo: {
alt: 'My Site Logo',
src: 'img/agent.png',
srcDark: 'img/agent-dark.png',
},
items: [
{
Expand Down
10 changes: 4 additions & 6 deletions src/pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
-webkit-box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.45);
-moz-box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.45);
box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.45);
background-color: #fff;
padding: 15px;
font: 400 12px Roboto, sans-serif;
box-sizing: initial;
Expand Down Expand Up @@ -67,8 +66,8 @@
}

.avatar {
width: 84px;
height: 116px;
width: auto;
height: auto;
max-width: initial;
}

Expand All @@ -87,13 +86,11 @@
}

.header__main {
color: #000;
text-align: center;
font-size: 24px;
}

.header__tagline {
color: #000;
text-align: center;
font-size: 10px;
}
Expand All @@ -110,7 +107,6 @@
}

.content__description {
color: #000;
text-align: center;
}

Expand All @@ -127,9 +123,11 @@
.github-icon {
width: auto;
height: 100%;
fill: var(--ifm-font-color-base);
}

.discord-icon {
width: auto;
height: 100%;
fill: var(--ifm-font-color-base);
}
36 changes: 33 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,43 @@ import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';
import { useColorMode } from '@docusaurus/theme-common';
import Heading from '@theme/Heading';

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

function Avatar() {
const { colorMode } = useColorMode();
return (
<img className={styles['avatar']} loading="lazy" srcSet="img/agent.png" />
<img
className={styles['avatar']}
loading="lazy"
srcSet={colorMode === 'dark' ? 'img/agent-dark.png' : 'img/agent.png'}
/>
);
}

function DiscordIcon() {
const path = 'img/discord-icon.svg#discord-icon'
return (
<svg
className={styles['discord-icon']}
viewBox='0 0 22.279521 17.139999'
>
<use xlinkHref={path} href={path} />
</svg>
);
}

function GithubIcon() {
const path = 'img/github-icon.svg#github-icon'
return (
<svg
className={styles['github-icon']}
viewBox='0 0 16 16'
>
<use xlinkHref={path} href={path} />
</svg>
);
}

Expand All @@ -36,13 +66,13 @@ function HomepageHeader() {
className={styles['icon-container']}
to={siteConfig.customFields.githubUrl}
>
<img className={styles['github-icon']} src="img/github-icon.svg" />
{GithubIcon()}
</Link>
<Link
className={styles['icon-container']}
to={siteConfig.customFields.discordInviteUrl}
>
<img className={styles['discord-icon']} src="img/discord-icon.svg" />
{DiscordIcon()}
</Link>
</div>
</div>
Expand Down
Binary file added static/img/agent-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion static/img/discord-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion static/img/github-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 944e5f3

Please sign in to comment.