Skip to content

Commit

Permalink
feat: add playground website layout (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
eryue0220 authored May 26, 2024
1 parent 2a7ec32 commit 0f1129f
Show file tree
Hide file tree
Showing 50 changed files with 1,261 additions and 87 deletions.
7 changes: 4 additions & 3 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tsConfigPath": "./tsconfig.json",
"tailwind": {
"config": "tailwind.config.js",
"config": "tailwind.config.ts",
"css": "src/assets/index.css",
"baseColor": "slate",
"cssVariables": true
},
"framework": "vite",
"aliases": {
"components": "src/components",
"utils": "src/utils"
"components": "src/ui",
"utils": "src/utils/index"
}
}
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<html class="dark" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="The JavaScript Oxidation Compiler">
<title>Oxc - The JavaScript Oxidation Compiler</title>
<link rel="icon" type="image/x-icon" href="https://raw.githubusercontent.com/Boshen/oxc-assets/main/oxc.ico">
<link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/oxc-project/oxc-assets/logo-round-min.png">
<style>
</style>
</head>
<body>
<div id="app"></div>
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build": "vue-tsc && vite build",
"preview": "vite preview",
"format": "prettier",
"typecheck": "vue-tsc",
"prepare": "husky"
},
"license": "MIT",
Expand All @@ -33,6 +34,8 @@
"vite": "^5.2.11"
},
"dependencies": {
"@radix-icons/vue": "^1.0.0",
"@vueuse/core": "^10.9.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-vue-next": "^0.378.0",
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 17 additions & 19 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<script setup lang="ts">
import Hello from "./components/Hello.vue";
import Header from "./components/Header/Header.vue";
import Sidebar from "./components/Sidebar/Sidebar.vue";
</script>

<template>
<Hello msg="Oxc Playground with Vue" />
</template>

<style scoped>
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
<Suspense>
<main class="flex w-screen h-screen bg-white dark:bg-[#1b1b1f]">
<Sidebar />
<div class="flex w-screen">
<Header />
<div>
<!-- Todo: Editor Component -->
</div>
</div>
</main>

.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
filter: drop-shadow(0 0 2em #42b883aa);
}
</style>
<template #fallback>
<!-- Todo: add fallback loading -->
</template>
</Suspense>
</template>
5 changes: 5 additions & 0 deletions src/assets/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
body {
font-family: var(--font-family-base);
margin: 0;
padding: 0;
}
22 changes: 22 additions & 0 deletions src/components/Header/Header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts">
import Logo from "../Logo/Logo.vue";
import Media from "./Media.vue";
import Nav from "./Nav.vue";
import Switch from "./Switch.vue";
</script>

<template>
<header class="relative w-full h-16">
<div class="flex justify-between w-full h-full px-8">
<Logo class="visible pc:invisible" />
<div class="hidden md:flex">
<Nav />
<Switch />
<Media />
</div>
</div>
<div
class="absolute bottom-0 w-full h-px border-b border-[#e2e2e3] dark:border-[#2e2e32]"
/>
</header>
</template>
55 changes: 55 additions & 0 deletions src/components/Header/Media.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<script setup lang="ts">
import {
GithubLogoIcon,
DiscordLogoIcon,
TwitterLogoIcon,
} from "@radix-icons/vue";
</script>

<template>
<div
class="hidden xl:flex items-center before:content-[''] before:w-px before:h-6 before:ml-4 before:mr-2 before:bg-[#e2e2e3] dark:before:bg-[#2e2e32]"
>
<ul class="flex items-center">
<li>
<a
class="block mx-2"
href="https://twitter.com/boshen_c"
aria-label="twitter"
target="_blank"
rel="noopener"
>
<TwitterLogoIcon
class="block w-5 h-5 text-[#3c3c43]/[.78] dark:text-[#ebebf5]/[.6]"
/>
</a>
</li>
<li>
<a
class="block mx-2"
href="https://discord.gg/9uXCAwqQZW"
aria-label="discord"
target="_blank"
rel="noopener"
>
<DiscordLogoIcon
class="block w-5 h-5 text-[#3c3c43]/[.78] dark:text-[#ebebf5]/[.6]"
/>
</a>
</li>
<li>
<a
class="block mx-2"
href="https://github.com/oxc-project/oxc"
aria-label="github"
target="_blank"
rel="noopener"
>
<GithubLogoIcon
class="block w-5 h-5 text-[#3c3c43]/[.78] dark:text-[#ebebf5]/[.6]"
/>
</a>
</li>
</ul>
</div>
</template>
95 changes: 95 additions & 0 deletions src/components/Header/Nav.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<script setup lang="ts">
import { ArrowTopRightIcon } from "@radix-icons/vue";
import {
NavigationMenu,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
} from "src/ui/navigation-menu";
</script>

<template>
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuLink as-child>
<a
class="flex items-center px-3"
href="https://oxc-project.github.io/docs/guide/introduction.html"
target="_blank"
rel="noopener"
>
<span
class="text-sm font-medium text-[#3c3c43] dark:text-[#fffff5]/[.86] hover:text-[#3451b2] dark:hover:text-[#a8b1ff]"
>
Guide
</span>
<ArrowTopRightIcon
class="w-3 h-3 ml-1 text-[#3c3c43]/[.56] dark:text-[#fffff5]/[.6]"
/>
</a>
</NavigationMenuLink>
</NavigationMenuItem>

<NavigationMenuItem>
<NavigationMenuLink as-child>
<a
class="flex items-center px-3"
href="https://oxc-project.github.io/docs/learn/parser_in_rust/intro.html"
target="_blank"
rel="noopener"
>
<span
class="text-sm font-medium text-[#3c3c43] dark:text-[#fffff5]/[.86] hover:text-[#3451b2] dark:hover:text-[#a8b1ff]"
>Learn</span
>
<ArrowTopRightIcon
class="w-3 h-3 ml-1 text-[#3c3c43]/[.56] dark:text-[#fffff5]/[.6]"
/>
</a>
</NavigationMenuLink>
</NavigationMenuItem>

<NavigationMenuItem>
<NavigationMenuLink
class="flex items-center px-3"
href="https://oxc-project.github.io/docs/contribute/introduction.html"
>
<span
class="text-sm font-medium text-[#3c3c43] dark:text-[#fffff5]/[.86] hover:text-[#3451b2] dark:hover:text-[#a8b1ff]"
>
Contribute
</span>
<ArrowTopRightIcon
class="w-3 h-3 ml-1 text-[#3c3c43]/[.56] dark:text-[#fffff5]/[.6]"
/>
</NavigationMenuLink>
</NavigationMenuItem>

<NavigationMenuItem>
<NavigationMenuLink class="flex items-center px-3" href="#" active>
<span class="text-sm font-medium text-[#3451b2] dark:text-[#a8b1ff]"
>Playground</span
>
</NavigationMenuLink>
</NavigationMenuItem>

<NavigationMenuItem>
<NavigationMenuLink as-child>
<a
class="flex items-center px-3"
href="#"
target="_blank"
rel="noopener"
>
<span
class="text-sm font-medium text-[#3c3c43] dark:text-[#fffff5]/[.86] hover:text-[#3451b2] dark:hover:text-[#a8b1ff]"
>
Resources
</span>
</a>
</NavigationMenuLink>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
</template>
54 changes: 54 additions & 0 deletions src/components/Header/Switch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from "vue";
import {
type SwitchRootProps,
type SwitchRootEmits,
SwitchRoot,
SwitchThumb,
useForwardPropsEmits,
} from "radix-vue";
import { useDark, useToggle } from "@vueuse/core";
import { cn } from "src/utils";
const props = defineProps<
SwitchRootProps & { class?: HTMLAttributes["class"] }
>();
const emits = defineEmits<SwitchRootEmits>();
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props;
return delegated;
});
const forwarded = useForwardPropsEmits(delegatedProps, emits);
const isDark = useDark();
const toggleDark = useToggle(isDark);
</script>

<template>
<div
class="hidden xl:flex items-center before:content-[''] before:w-px before:h-6 before:ml-2 before:mr-4 before:bg-[#e2e2e3] dark:before:bg-[#2e2e32]"
>
<SwitchRoot
@click="toggleDark()"
v-bind="forwarded"
v-model:checked="isDark"
role="switch"
:class="
cn(
'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full bg-[#8e96aa]/[.16] dark:bg-[#657585]/[.16] border border-[#c2c2c4] dark:border-[#3c3f44] hover:border-[#a8b1ff] dark:hover:border-[#a8b1ff] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50',
props.class,
)
"
>
<SwitchThumb
:class="
cn(
'pointer-events-none block h-5 w-5 rounded-full bg-white dark:bg-black shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',
)
"
/>
</SwitchRoot>
</div>
</template>
11 changes: 0 additions & 11 deletions src/components/Hello.vue

This file was deleted.

18 changes: 18 additions & 0 deletions src/components/Logo/Logo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div class="flex items-center justify-between h-16">
<a
class="flex items-center w-full h-full border-b border-[#e2e2e3] dark:border-[#2e2e32]"
href="https://oxc-project.github.io"
>
<img
class="w-6 h-6 mr-2"
src="https://cdn.jsdelivr.net/gh/oxc-project/oxc-assets/logo-round-min.png"
alt="logo"
/>
<span
class="text-base font-medium text-[#3c3c43] dark:text-[#fffff5]/[.86]"
>Oxc</span
>
</a>
</div>
</template>
Loading

0 comments on commit 0f1129f

Please sign in to comment.