feat: dark mode style.

This commit is contained in:
Ivan Li 2021-05-02 13:05:12 +08:00
parent 4e14860d34
commit d3301da0ad
4 changed files with 75 additions and 32 deletions

View File

@ -1,15 +1,24 @@
.sidebar { .wrapper {
@apply bg-green-400 text-white; @apply bg-green-400 text-white;
@apply overflow-hidden flex flex-col; :global(.dark) & {
@apply text-center; @apply bg-gray-800 text-gray-400;
}
}
.sidebar {
@apply overflow-hidden flex flex-col fixed top-0;
@apply text-center shadow-2xl;
height: 100vh; height: 100vh;
padding-top: 10vh; padding-top: 10vh;
} }
.avatar { .avatar {
@apply md:w-36 md:h-36 rounded-full;
@apply w-16 h-16; @apply w-16 h-16;
@apply md:w-36 md:h-36 rounded-full;
@apply mx-auto md:my-8 flex-none; @apply mx-auto md:my-8 flex-none;
:global(.dark) & {
@apply filter brightness-75;
}
} }
.name { .name {
@ -17,10 +26,14 @@
@apply md:my-8 my-4 flex-none select-all; @apply md:my-8 my-4 flex-none select-all;
} }
.nav { .nav {
@apply my-auto; @apply my-auto text-left self-center;
} }
.navItem { .navItem {
@apply leading-8 md:text-lg cursor-pointer my-1; @apply leading-8 md:text-lg cursor-pointer my-2;
@apply tracking-widest;
small {
@apply text-xs md:inline hidden;
}
&:hover { &:hover {
text-shadow: 0 0px 5px #abbf00; text-shadow: 0 0px 5px #abbf00;
} }
@ -28,4 +41,8 @@
.bio { .bio {
@apply text-sm text-opacity-70 text-white; @apply text-sm text-opacity-70 text-white;
@apply my-4; @apply my-4;
:global(.dark) & {
@apply text-gray-500;
}
} }

View File

@ -13,29 +13,40 @@ interface Props {
export const GlobalSidebar: FC<Props> = ({className}) => { export const GlobalSidebar: FC<Props> = ({className}) => {
return ( return (
<aside className={classnames(className, styles.sidebar)}> <div className={classnames(className, styles.wrapper)}>
<img className={styles.avatar} src="/images/avatar.png" /> <aside className={classnames(className, styles.sidebar)}>
<h2 className={styles.name}>{fullName}</h2> <img className={styles.avatar} src="/images/avatar.png" />
<h2 className={styles.name}>{fullName}</h2>
<nav className={styles.nav}> <nav className={styles.nav}>
<ul> <ul>
<Link href="/"> <Link href="/">
<li className={styles.navItem}></li> <li className={styles.navItem}>
</Link>
<Link href="/tags"> <small> / ARTICLES</small>
<li className={styles.navItem}></li> </li>
</Link> </Link>
<Link href="/about"> <Link href="/tags">
<li className={styles.navItem}></li> <li className={styles.navItem}>
</Link>
</ul> <small> / TAGS</small>
</nav> </li>
<footer className={classnames(styles.bio, "md:block hidden")}> </Link>
{"“人造的身体,借来的心”"} <Link href="/about">
</footer> <li className={styles.navItem}>
<footer className={classnames(styles.bio, "md:hidden block")}>
{"好挤 (#`O)"} <small> / ABOUT</small>
</footer> </li>
</aside> </Link>
</ul>
</nav>
<footer className={classnames(styles.bio, "md:block hidden")}>
{"“人造的身体,借来的心”"}
</footer>
<footer className={classnames(styles.bio, "md:hidden block")}>
{"好挤 (#`O)"}
</footer>
</aside>
</div>
); );
}; };

View File

@ -7,10 +7,17 @@
.primary { .primary {
@apply flex-auto; @apply flex-auto;
@apply bg-gray-100 text-gray-700; @apply bg-gray-100 text-gray-700;
:global(.dark) & {
@apply bg-gray-700 text-gray-300;
}
.wrapper { .wrapper {
@apply mx-auto max-w-screen-xl; @apply mx-auto max-w-screen-xl;
} }
} }
.pageHeader { .pageHeader {
@apply p-3 bg-gray-50 flex justify-between; @apply p-3 bg-gray-50 flex justify-between;
:global(.dark) & {
@apply bg-gray-800;
}
} }

View File

@ -4,14 +4,22 @@
} }
.item { .item {
@apply my-2 mx-4 px-3 overflow-hidden; @apply my-2 mx-4 px-4 overflow-hidden;
@apply rounded-md shadow-sm hover:shadow; @apply rounded-md shadow-sm hover:shadow;
@apply bg-gray-50 hover:bg-white; @apply bg-gray-50 hover:bg-white;
:global(.dark) & {
@apply bg-gray-800;
}
.title { .title {
@apply text-lg my-2; @apply text-lg my-4;
} }
.description { .description {
@apply text-sm text-gray-600 leading-6 my-2; @apply text-sm text-gray-600 leading-6 my-4;
:global(.dark) & {
@apply text-gray-400;
}
} }
} }