Skip to content

Commit

Permalink
feat: added dark theme in landing
Browse files Browse the repository at this point in the history
  • Loading branch information
mikededo committed Aug 13, 2023
1 parent 69e25bd commit 84f62c1
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"@/editor/": "./src/apps/editor",
"@/landing/": "./src/apps/landing",
"@/aero": "./src/libs/aero/index.ts",
"@/pulse": "./src/libs/pulse/index.ts"
"@/pulse": "./src/libs/pulse/index.ts",
"@/chain": "./src/libs/chain/index.ts"
},
"node": {
"extensions": [".ts", ".tsx"],
Expand Down
3 changes: 2 additions & 1 deletion src/apps/editor/components/menu/options/dark-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { MoonIcon } from '@primer/octicons-react';
import React, { useEffect } from 'react';

import { IconButton } from '@/aero';
import { useFeatureSwitch, useThemeMode } from '@/editor/stores';
import { useThemeMode } from '@/chain';
import { useFeatureSwitch } from '@/editor/stores';

export const DarkThemeMenuOption: React.FC = () => {
const { fsDarkTheme } = useFeatureSwitch('fsDarkTheme');
Expand Down
1 change: 0 additions & 1 deletion src/apps/editor/stores/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './global-state';
export * from './use-horizontal-notifier';
export * from './use-theme-mode';
23 changes: 23 additions & 0 deletions src/apps/landing/components/dark-mode/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MoonIcon } from '@primer/octicons-react';
import React from 'react';

import { IconButton } from '@/aero';
import { useThemeMode } from '@/chain';

export const DarkModeToggler = () => {
const { mode, onToggleMode } = useThemeMode();

const handleOnClick = () => {
onToggleMode();
};

return (
<IconButton
className="!p-2 ml-auto"
selected={mode === 'dark'}
onClick={handleOnClick}
>
<MoonIcon />
</IconButton>
);
};
22 changes: 13 additions & 9 deletions src/apps/landing/components/footer/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@ import React from 'react';
import { Grid, VCol } from '@/aero';

const Link = ({ text, href }: { text: string; href: string }) => (
<p className="text-primary-foreground">
<p className="text-mutedforeground">
<a className="hover:underline" href={href}>
{text}
</a>
</p>
);

export const Footer: React.FC = () => (
<footer className="bg-primary mt-4 md:mt-12 px-12 py-8">
<Grid container size={12} className="w-full mb-12 md:mb-16">
<Grid item columns={1} />
<Grid item columns={5} md={4}>
<footer className="bg-muted mt-4 md:mt-12 px-12 py-8">
<Grid
container
size={12}
className="w-full max-w-5xl mx-auto mb-12 md:mb-16"
rowGap="lg"
>
<Grid item columns={12} sm={6} md={4}>
<VCol variant="sm">
<h4 className="text-primary-foreground font-semibold text-lg mb-2">
<h4 className="text-mutedforeground font-semibold text-lg mb-2">
Links
</h4>
<Link text="Github @mikededo" href="https://github.com/mikededo" />
Expand All @@ -26,9 +30,9 @@ export const Footer: React.FC = () => (
/>
</VCol>
</Grid>
<Grid item columns={5} md={4}>
<Grid item columns={12} sm={6} md={4}>
<VCol variant="sm">
<h4 className="text-primary-foreground font-semibold text-lg mb-2">
<h4 className="text-mutedforeground font-semibold text-lg mb-2">
Special thanks
</h4>
<Link text="Vercel" href="https://vercel.com" />
Expand All @@ -37,7 +41,7 @@ export const Footer: React.FC = () => (
</VCol>
</Grid>
</Grid>
<p className="text-primary-foreground text-center w-full">
<p className="text-mutedforeground text-center w-full">
Miquel de Domingo @mikededo {new Date().getFullYear()}
</p>
</footer>
Expand Down
3 changes: 3 additions & 0 deletions src/apps/landing/components/nav/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';

import { Row } from '@/aero';

import { DarkModeToggler } from '../dark-mode';

export const Nav: React.FC = () => (
<Row
as="nav"
Expand All @@ -17,5 +19,6 @@ export const Nav: React.FC = () => (
<p className="self-center text-sm uppercase font-semibold">
🚧 This page is still under construction 🚧
</p>
<DarkModeToggler />
</Row>
);
1 change: 1 addition & 0 deletions src/libs/chain/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useThemeMode } from './use-theme-mode';
File renamed without changes.
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"@/editor/*": ["./src/apps/editor/*"],
"@/landing/*": ["./src/apps/landing/*"],
"@/aero": ["./src/libs/aero/index.ts"],
"@/pulse": ["./src/libs/pulse/index.ts"]
"@/pulse": ["./src/libs/pulse/index.ts"],
"@/chain": ["./src/libs/chain/index.ts"]
},
"allowJs": true,
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit 84f62c1

Please sign in to comment.