Skip to content

Commit

Permalink
feat: redesign (nuxt-modules#123)
Browse files Browse the repository at this point in the history
* feat: redesign header

* feat: improve search input and modal

* feat: redesign aside category list item

* fix: dark mode aside category item color

* feat: redesign TOC

* feat: redesign landing page

* fix: TOC title and icon

* feat: copy button in code blocks; closes nuxt-modules#117

* fix: dark mode TOC colors

* feat: refactor logo component; add option for logo+text customization; closes nuxt-modules#110

* fix: redesign external resources

* feat: redesign mobile navbar

* feat: move mobile menu button to header

* chore: cleanup

* fix: coding session

* feat: update typography

* chore: fixes

* fix: left align hamburger icon

* fix: make body lock work on iOS

* fix: try mobile safari aside fix

* fix: missing Tailwind config

* fix: try native CSS solution for mobile Safari aside issue

* fix: try -webkit-fill-available for mobile Safari bug

* fix: ...

* chore: cleanup

* feat: use warm gray pallete for dark mode

* fix: add missing dependency

* chore: update default color

Co-authored-by: Sébastien Chopin <[email protected]>
  • Loading branch information
bdrtsky and atinux authored Mar 10, 2021
1 parent 9a4930e commit 23fa6d2
Show file tree
Hide file tree
Showing 28 changed files with 1,208 additions and 835 deletions.
12 changes: 6 additions & 6 deletions docs/components/AsideBottom.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<div class="mt-8">
<h5 class="px-4 mb-3 text-sm font-semibold tracking-wide text-gray-900 uppercase lg:px-3 lg:mb-3 lg:text-xs dark:text-gray-100">Resources</h5>
<ul class="mt-4">
<div>
<h5 class="py-2 text-base font-semibold text-gray-900 transition duration-200 cursor-pointer dark:text-gray-100">Resources</h5>
<ul>
<li v-for="resource of resources" :key="resource.title">
<a :href="resource.url" target="_blank" rel="noopener" class="flex items-center px-4 py-2 rounded group lg:px-3 dark:hover:text-gray-100 hover:text-gray-900 hover:bg-gray-50 dark:hover:bg-gray-800 ">
<a :href="resource.url" target="_blank" rel="noopener" class="flex items-center py-2 group dark:hover:text-gray-100 hover:text-gray-900 ">
<component :is="resource.icon" v-if="resource.icon" class="w-5 h-5 mr-2" />
<span class="flex-1">{{ resource.title }}</span>
<IconExternalLink class="w-4 h-4 ml-2 transition-opacity opacity-0 group-hover:opacity-70" />
<span>{{ resource.title }}</span>
<IconExternalLink class="w-4 h-4 ml-2 text-gray-400 opacity-0 group-hover:opacity-100" />
</a>
</li>
</ul>
Expand Down
11 changes: 8 additions & 3 deletions docs/components/ButtonLink.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<template>
<NuxtLink v-if="isInternal" :to="href" class="button-link" :class="size"><slot /></NuxtLink>
<a v-else :href="href" class="button-link" :class="size" v-bind="linkAttrs"><slot /></a>
<NuxtLink
v-if="isInternal"
:to="href"
class="button-link"
:class="size"
><slot /></NuxtLink>
<a v-else :href="href" class="button-link" :class="size" v-bind="linkAttrs"><slot /><IconExternalLink v-if="blank" class="w-4 h-4 ml-2" /></a>
</template>

<script>
Expand Down Expand Up @@ -35,7 +40,7 @@ export default {

<style lang="postcss">
a.button-link {
@apply flex-none w-full px-4 py-2.5 leading-4 text-base font-semibold text-white transition-colors duration-200 border border-transparent bg-primary-500 sm:w-auto hover:bg-primary-700 rounded focus:ring-2 focus:ring-offset-2 focus:ring-offset-white focus:ring-gray-900 focus:outline-none;
@apply inline-flex items-center flex-none px-4 py-2.5 leading-4 text-base font-semibold text-white transition-colors duration-200 border border-transparent bg-primary-500 hover:bg-primary-600 rounded focus:ring-2 focus:ring-offset-2 focus:ring-offset-white focus:ring-primary-600 focus:outline-none;
&.large {
@apply px-6 py-3 leading-6 text-lg rounded-md;
}
Expand Down
72 changes: 72 additions & 0 deletions docs/components/Terminal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<template>
<div
ref="copyInstall"
:data-clipboard-text="snippet"
class="relative flex flex-col w-full h-64 overflow-hidden text-gray-600 bg-gray-800 rounded-lg cursor-pointer"
>
<div
v-if="copied"
class="absolute top-0 left-0 z-10 flex items-center justify-center w-full h-full"
>
<div
class="absolute top-0 left-0 w-full h-full bg-gray-900 opacity-75"
></div>
<div class="z-10 text-lg font-medium text-gray-100">
Copied!
</div>
</div>
<div
class="relative flex items-center w-full h-12 border-b border-gray-700"
>
<div class="flex ml-4">
<div class="w-3 h-3 bg-red-400 rounded-full"></div>
<div class="w-3 h-3 ml-2 bg-yellow-400 rounded-full"></div>
<div class="w-3 h-3 ml-2 bg-green-400 rounded-full"></div>
</div>
<div
class="absolute top-0 left-0 flex items-center justify-center w-full h-full"
>
Bash
</div>
</div>
<div class="flex p-4 font-mono">
<span class="inline-block mr-2 font-bold select-none">$</span>
<span class="inline-block text-gray-200">{{ snippet }}</span>
</div>
</div>
</template>

<script>
import Clipboard from "clipboard";
export default {
props: {
snippet: {
type: String,
required: true
}
},
data() {
return {
copied: false
};
},
mounted() {
this.setupCopyInstall();
},
methods: {
setupCopyInstall() {
if (!this.$refs.copyInstall) {
return this.$nextTick(this.setupCopyInstall);
}
const copyInstall = new Clipboard(this.$refs.copyInstall);
copyInstall.on("success", () => {
this.copied = true;
setTimeout(() => {
this.copied = false;
}, 1000);
});
}
}
};
</script>
2 changes: 1 addition & 1 deletion docs/content/1.get-started/2.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The theme design is based on a `primary` color to make it easy to override, you
| `github.apiUrl` | `String` | For GitHub Enterprise, in addition to `github.repo`, you have to assign an api url. Example: `https://hostname/api/v3/repos`. Defaults to `https://api.github.com/repos`. |
| `github.branch` | `String` | The default branch for the GitHub repository of your project, used in the `Edit this page on GitHub link` on each page (defaults to `main` if it cannot be detected). |
| `github.dir` | `String` | The default dir of your project, used in the `Edit this page on GitHub link` on each page (defaults to `''`). Change it if docus is not at the root of your repository. |
| `colors.primary` | `String` | The primary color of the theme, the value should be hexadecimal or rgb (`145,22,74`). |
| `colors.primary` | `String` | The primary color of the theme, the value should be hexadecimal or rgb (`145,22,74`). Default value is `#3073F1`. |
| `algolia` | `Object` | This option allows you to use [Algolia DocSearch](https://docsearch.algolia.com). In order to enable it, you need to provide at least the `apiKey` and the `indexName`. See example below. |

### Algolia Search
Expand Down
16 changes: 14 additions & 2 deletions docs/content/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@
"github": {
"repo": "nuxtlabs/docus",
"branch": "main",
"dir": "docs"
"dir": "docs",
"releases": true
},
"algolia": {
"colors": {
"primary": "#3073F1"
},
"_algolia": {
"apiKey": "d8bb34f345ca54362176cf78fcf4ed9d",
"indexName": "docus"
},
"logo": {
"dark": "/logo-dark.svg",
"light": "/logo-light.svg"
},
"header": {
"logo": false,
"title": true
}
}
143 changes: 69 additions & 74 deletions docs/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,117 +1,112 @@
<template>
<Container>
<Page>
<h1 class="mt-10 mb-8 text-4xl font-extrabold leading-none tracking-tight text-gray-900 dark:text-gray-100 sm:text-6xl lg:text-7xl sm:mt-14 sm:mb-10">
Documentation generator<br>based on Nuxt and Tailwind.
<Container aside fluid>
<template #header>
<Header>
<template #desktop-right>
<ButtonLink href="/get-started/installation">Get started</ButtonLink>
</template>
</Header>
</template>
<template #aside>
<Aside class="block lg:hidden" />
</template>
<section class="px-4 mx-auto my-24 max-w-8xl">
<h1
class="my-8 text-4xl font-semibold leading-none tracking-tight text-center text-gray-900 md:text-left dark:text-gray-100 sm:text-6xl lg:text-8xl sm:my-14"
>
Documentation generator<br />based on Nuxt and Tailwind.
</h1>
<h3 class="mb-10 text-lg font-medium text-gray-800 sm:text-2xl sm:leading-10 sm:mb-11 dark:text-gray-200">
Write in markdown, use Vue components, add style with TailwindCSS
and enjoy the power of Nuxt.
</h3>
<div class="flex flex-wrap space-y-4 text-center sm:space-y-0 sm:space-x-4">
<ButtonLink size="large" href="/get-started/installation">Get started</ButtonLink>
<button
ref="copyInstall"
data-clipboard-text="npx degit nuxtlabs/docus-starter#main my-docs"
type="button"
class="flex items-center justify-center flex-none w-full py-3 space-x-2 font-mono leading-6 text-gray-400 transition-colors duration-200 border border-gray-200 dark:border-gray-700 sm:w-auto bg-gray-50 dark:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-100 sm:px-6 rounded-xl focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-600 focus:ring-gray-300 dark:focus:ring-gray-700 focus:outline-none"
>
<span class="text-gray-900 dark:text-gray-100">
<span class="hidden text-gray-500 sm:inline" aria-hidden="true">$ </span>
npx degit nuxtlabs/docus-starter
</span>
<span class="sr-only">(click to copy to clipboard)</span>
<IconClipboardCheck v-if="copied" class="w-6 h-6 text-green-400" stroke-width="1.5" />
<IconClipboardCopy v-else class="w-6 h-6" stroke-width="1.5" />
</button>
<div class="flex flex-col md:flex-row">
<div class="flex flex-col items-start pr-0 mb-8 md:pr-2 lg:pr-8 md:w-1/2">
<h3
class="mb-4 text-lg text-center text-gray-700 md:text-left sm:text-xl md:text-2xl sm:leading-tight sm:mb-8 dark:text-gray-200"
>
Write in markdown, use Vue components, add style with TailwindCSS
and enjoy the power of Nuxt.
</h3>
<ButtonLink
class="mx-auto md:mx-0"
size="large"
href="/get-started/installation"
>
Get started
</ButtonLink>
<!-- TODO: GitHub stars Button -->
</div>
<div class="w-full m-auto md:w-1/2 sm:w-580px ">
<div class="md:pl-2">
<Terminal snippet="npx degit nuxtlabs/docus-starter" />
</div>
</div>
</div>
<section>
<h2 class="mt-16 mb-8 text-3xl font-extrabold tracking-tight text-gray-900 dark:text-gray-100">What’s included?</h2>
<ul class="grid grid-cols-2 gap-4 font-semibold text-center text-gray-900 dark:text-gray-100 sm:grid-cols-3 xl:grid-cols-4 sm:gap-6 xl:gap-8">
</section>
<section class="py-24 bg-gray-50 dark:bg-gray-800">
<div class="px-4 mx-auto max-w-8xl">
<h2
class="mb-8 text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100"
>
What’s included?
</h2>
<ul
class="grid gap-4 font-semibold text-left text-gray-900 dark:text-gray-100 sm:grid-cols-2 xl:grid-cols-3 2xl:gap-8"
>
<li v-for="feature of features" :key="feature.title" class="flex">
<NuxtLink class="relative w-full px-6 pt-8 pb-6 border-2 border-gray-100 rounded-xl dark:border-gray-800" :to="feature.url">
<component :is="feature.icon" v-if="feature.icon" class="h-16 max-w-full mx-auto mb-3" />
<h2>{{ feature.title }}</h2>
</NuxtLink>
<div class="relative w-full px-6 py-8 bg-white rounded shadow dark:bg-gray-900 hover:shadow-lg">
<component
:is="feature.icon"
v-if="feature.icon"
class="h-16 max-w-full mb-3"
/>
<h2 class="mb-2 text-xl">{{ feature.title }}</h2>
<p class="font-normal">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Earum voluptatibus veritatis maxime est qui blanditiis aut libero quod. Doloremque obcaecati voluptate tenetur quia fuga veniam incidunt rerum voluptatibus iusto earum.</p>
<!-- TODO: feature.description -->
</div>
</li>
</ul>
</section>
</Page>
</div>
</section>
</Container>
</template>

<script>
import Clipboard from 'clipboard'
export default {
data () {
return {
copied: false,
features: [
{
icon: 'IconMarkdown',
title: 'Write Markdown',
url: '/usage/template'
title: 'Write Markdown'
},
{
icon: 'IconVue',
title: 'Vue Components',
url: '/usage/components'
title: 'Vue Components'
},
{
icon: 'IconNuxt',
title: 'Nuxt Architecture',
url: '/get-started/configuration#nuxt'
title: 'Nuxt Architecture'
},
{
icon: 'IconTailwind',
title: 'Tailwind CSS',
url: '/get-started/configuration#tailwindcss'
title: 'Tailwind CSS'
},
{
icon: 'IconSSG',
title: 'Static Generation',
url: '/more/deployment'
title: 'Static Generation'
},
{
icon: 'IconLighthouse',
title: 'Lighthouse Optimised',
url: '/more/performances'
title: 'Lighthouse Optimised'
},
{
icon: 'IconZap',
title: 'Smart Generation',
url: '/more/performances#smart-generation'
title: 'Smart Generation'
},
{
icon: 'IconPuzzle',
title: 'Extensible',
url: '/usage/template'
title: 'Extensible'
}
]
}
},
head () {
return {
title: 'Docus - Documentation generator based on Nuxt and Tailwind.'
}
},
mounted () {
this.setupCopyInstall()
},
methods: {
setupCopyInstall () {
if (!this.$refs.copyInstall) {
return this.$nextTick(this.setupCopyInstall)
}
const copyInstall = new Clipboard(this.$refs.copyInstall)
copyInstall.on('success', () => {
this.copied = true
setTimeout(() => {
this.copied = false
}, 1000)
})
}
}
}
</script>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@vueuse/integrations": "^4.3.4",
"clipboard": "^2.0.7",
"defu": "^3.2.2",
"graceful-fs": "^4.2.6",
"lodash.groupby": "^4.6.0",
"nuxt-i18n": "^6.20.6",
"ohmyfetch": "^0.1.8",
Expand Down
8 changes: 4 additions & 4 deletions theme/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ body {

/* Style copy button added in `pages/_.vue` */
& > .copy {
@apply hidden absolute right-0 bottom-0 leading-none shadow-lg px-1.5 py-1.5 text-white bg-gray-800 text-sm uppercase rounded-md border border-white font-semibold mr-3 mb-3;
@apply outline-none absolute right-0 bottom-0 leading-none px-3 py-1.5 text-white bg-gray-700 text-xs rounded-tl-md border border-b-0 border-r-0 border-gray-600 font-mono;

&:hover {
@apply bg-gray-700;
@apply bg-gray-600 border-gray-500;
}

&:focus {
@apply bg-gray-600 outline-none;
@apply bg-gray-600 border-gray-500;
}

&.copied {
@apply text-green-200 border-green-200;
@apply bg-gray-600 border-gray-500;
}
}

Expand Down
Loading

0 comments on commit 23fa6d2

Please sign in to comment.