Skip to content

Commit

Permalink
improve CardGrid; CardGrid docs; SectionHeader component
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrtsky committed May 15, 2023
1 parent 57a5c52 commit 8248502
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 90 deletions.
9 changes: 3 additions & 6 deletions .docs/content/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,10 @@ backgroundImage: linear-gradient(transparent 75%, {docus.body.backgroundColor})
::

#default
::card-grid{cols=6 gap=1rem}
::card-grid{cols=6}

#subtitle
Features

#title
What's included
#root
:section-header{title="What's included" subtitle="Features"}

#default
::card{icon=logos:nuxt-icon lights noise}
Expand Down
2 changes: 1 addition & 1 deletion .docs/content/2.components/1.elements/9.tooltip.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The element that serves as the tooltip container has `role="tooltip"`. The eleme

## Props

| **Props** | **Type** | **Default** | **Description** |
| **Prop** | **Type** | **Default** | **Description** |
| --- | --- | --- | --- |
| **content** | `String` | `undefined` | Tooltip content |
| **tabbable** | `Boolean` | `false` | Whether tooltip is tabbable or not |
Expand Down
104 changes: 103 additions & 1 deletion .docs/content/2.components/3.landing/1.hero.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,102 @@

The `Hero` component is a versatile and visually appealing element designed for the landing page. It serves as the first screen that captures users' attention and introduces them to the key features and messaging of the product. The component incorporates a title, description, announce, call-to-action buttons, some extra content slot and a flexible area for visual content, such as images, videos, or animations (or `Terminal` in case of Docus website).

## Usage

::code-group
::code-preview{label="Preview" column}
::hero{style="min-width: 1280px;"}

#announce
::announce{href=https://docus.dev/v2}
Docus v2 is out 🎉
::

#title
The best place to start your documentation.

#description
Write pages in [:icon{name=mdi:language-markdown}]{style="margin-right:4px"} [Markdown](https://content.nuxtjs.org), use [:icon{name=vscode-icons:file-type-vue}]{style="margin-right:4px"} [Vue](https://vuejs.org) components and enjoy the power of [:icon{name=vscode-icons:file-type-nuxt}]{style="margin-right:4px"} [Nuxt](https://nuxt.com).

#extra
::list
- **+50 Components** ready to build rich pages
- **Docs** and **Page** layouts
- Start from a `README`, scale to a framework documentation
- Navigation and Table of Contents generation
- Fully configurable design system
- Leverages [**Typography**](https://typography.nuxt.space/) and [**Elements**](https://elements.nuxt.dev)
- Used on [Content Documentation](https://content.nuxtjs.org)
::

#actions
::button-link{href=/introduction/getting-started size=medium}
Get started
::
::button-link{href=https://github.com/nuxt-themes/docus size=medium color=gray ghost blank}
Open on GitHub →
::

#support
::terminal
---
content:
- npx nuxi@latest init -t themes/docus
- cd docs
- npm install
- npm run dev
---
::
::
::

```md [MDC]
::hero

#announce
::announce{href=https://docus.dev/v2}
Docus v2 is out 🎉
::

#title
The best place to start your documentation.

#description
Write pages in [:icon{name=mdi:language-markdown}]{style="margin-right:4px"} [Markdown](https://content.nuxtjs.org), use [:icon{name=vscode-icons:file-type-vue}]{style="margin-right:4px"} [Vue](https://vuejs.org) components and enjoy the power of [:icon{name=vscode-icons:file-type-nuxt}]{style="margin-right:4px"} [Nuxt](https://nuxt.com).

#extra
::list
- **+50 Components** ready to build rich pages
- **Docs** and **Page** layouts
- Start from a `README`, scale to a framework documentation
- Navigation and Table of Contents generation
- Fully configurable design system
- Leverages [**Typography**](https://typography.nuxt.space/) and [**Elements**](https://elements.nuxt.dev)
- Used on [Content Documentation](https://content.nuxtjs.org)
::

#actions
::button-link{href=/introduction/getting-started size=medium}
Get started
::
::button-link{href=https://github.com/nuxt-themes/docus size=medium color=gray ghost blank}
Open on GitHub →
::

#support
::terminal
---
content:
- npx nuxi@latest init -t themes/docus
- cd docs
- npm install
- npm run dev
---
::
::
```
::

## Slots

| **Name** | **Description** |
Expand Down Expand Up @@ -68,6 +164,8 @@ export default defineTheme({
letterSpacing: '{letterSpacing.tight}',
paddingX: {
initial: '{space.8}',
md: '{space.12}',
lg: '{space.14}',
xl: '{space.0}'
},
textAlign: {
Expand Down Expand Up @@ -96,7 +194,11 @@ export default defineTheme({
lg: '{text.xl.lineHeight}'
},
color: '{elements.text.secondary.color.static}',
paddingX: '{space.2}',
paddingX: {
initial: '{space.2}',
md: '{space.6}',
xl: '{space.0}'
},
mixBlendMode: 'normal'
},
extra: {
Expand Down
2 changes: 1 addition & 1 deletion .docs/content/2.components/3.landing/2.terminal.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The `Terminal` component is used to display terminal commands. User could copy t

## Props

| **Props** | **Type** | **Default** | **Description** |
| **Prop** | **Type** | **Default** | **Description** |
|--|--|--|--|
| `content` | `[Array, String]` | `undefined` | One or multiple terminal commands. The prop is `required` |

Expand Down
47 changes: 47 additions & 0 deletions .docs/content/2.components/3.landing/4.card-grid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Card Grid

The `CardGrid` component is a layout component that allows you to display a grid of `Card`'s.

## Usage

::code-group
::code-preview{label="Preview" column}
::card-grid{style="--docus-landing-card-wrapper-backgroundColor: var(--elements-surface-secondary-backgroundColor);"}
::card
Card
::
::card{row=2}
Card
::
::card
Card
::
::card{row=2}
Card
::
::card{col=2}
Card
::
::card
Card
::
::
::
```md [MDC]
```
::

## Props

| Prop | Type | Default | Description |
|--|--|--|--|
| `cols` | `[String, Number, Object]` | `3` | Number of columns to display |
| `gap` | `[String, Object]` | `{ initial: '{space.4}', '2xl': '{space.6}' }` | Gap between cards |

## Slots

| Slot | Description |
| --- | --- |
| `root` | A slot for any content, rendered at the root of the component |
| `default` | `Card` components to be displayed in the grid. |

2 changes: 1 addition & 1 deletion components/landing/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ watch([elementX, elementY], () => {
<div ref="cardRef" class="card" :class="{lights}">
<div class="wrapper">
<div v-if="noise" class="noise" />
<slot />
<div class="content">
<ContentSlot :use="$slots.default" unwrap="p" />
<span v-if="icon" class="icon-wrapper">
<Icon :name="icon" />
</span>
Expand Down
50 changes: 11 additions & 39 deletions components/landing/CardGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ defineProps({
type: [String, Number, Object],
default: 3
},
subtitleColor: {
type: String,
default: '{color.primary.500}'
gap: {
type: [String, Object],
default: () => ({
initial: '{space.4}',
'2xl': '{space.6}'
})
}
})
</script>
Expand All @@ -21,14 +24,6 @@ defineProps({

<ContentSlot :use="$slots.root" />

<span v-if="$slots.subtitle" class="subtitle">
<ContentSlot :use="$slots.subtitle" unwrap="p" />
</span>

<h2 v-if="$slots.title" class="title">
<ContentSlot :use="$slots.title" unwrap="p" />
</h2>

<div class="card-grid-layout">
<slot />
</div>
Expand All @@ -38,38 +33,15 @@ defineProps({
<style scoped lang="ts">
css({
'.card-grid': {
'--subtitleColor': (props) => props.subtitleColor,
position: '{docus.landing.cardGrid.position}',
paddingBottom: '{docus.landing.cardGrid.paddingBottom}',
'.subtitle': {
display: 'block',
fontSize: '{docus.landing.cardGrid.subtitle.fontSize}',
lineHeight: '{docus.landing.cardGrid.subtitle.lineHeight}',
fontWeight: '{docus.landing.cardGrid.subtitle.fontWeight}',
color: 'var(--subtitleColor)',
marginBottom: '{docus.landing.cardGrid.subtitle.marginBottom}',
letterSpacing: '{docus.landing.cardGrid.subtitle.letterSpacing}',
},
'.title': {
width: '{docus.landing.cardGrid.title.width}',
marginBottom: '{docus.landing.cardGrid.title.marginBottom}',
fontSize: '{docus.landing.cardGrid.title.fontSize}',
lineHeight: '{docus.landing.cardGrid.title.lineHeight}',
fontWeight: '{docus.landing.cardGrid.title.fontWeight}',
letterSpacing: '{docus.landing.cardGrid.title.letterSpacing}',
color: '{docus.landing.cardGrid.title.color}',
gradientText: '{docus.landing.cardGrid.title.gradientText}',
},
'--gap': props => props.gap,
position: 'relative',
width: '100%',
'.card-grid-layout': {
textAlign: 'start',
display: 'grid',
gridTemplateColumns: props => `repeat(${props.cols}, 1fr)`,
gap: '{docus.landing.cardGrid.layout.gap}',
gridAutoRows: 'minmax(180px, auto)',
gap: '{gap}',
gridAutoRows: 'minmax({docus.landing.card.minHeight}, auto)',
gridAutoFlow: 'dense',
},
Expand Down
1 change: 1 addition & 0 deletions components/landing/Hero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ css({
'.hero': {
position: 'relative',
padding: '{docus.landing.hero.padding}',
width: '100%',
'.layout': {
position: 'relative',
Expand Down
58 changes: 58 additions & 0 deletions components/landing/SectionHeader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script setup lang="ts">
defineProps({
subtitle: {
type: String,
default: 'Section subtitle'
},
subtitleColor: {
type: String,
default: '{color.primary.500}'
},
title: {
type: String,
default: 'Section title'
}
})
</script>

<template>
<div>
<span v-if="subtitle || $slots.subtitle" class="subtitle">
<ContentSlot :use="$slots.subtitle" unwrap="p">
{{ subtitle }}
</ContentSlot>
</span>

<h2 v-if="title || $slots.title" class="title">
<ContentSlot :use="$slots.title" unwrap="p">
{{ title }}
</ContentSlot>
</h2>
</div>
</template>

<style scoped lang="ts">
css({
'.subtitle': {
'--subtitleColor': (props) => props.subtitleColor,
display: 'block',
fontSize: '{docus.landing.sectionHeader.subtitle.fontSize}',
lineHeight: '{docus.landing.sectionHeader.subtitle.lineHeight}',
fontWeight: '{docus.landing.sectionHeader.subtitle.fontWeight}',
color: 'var(--subtitleColor)',
marginBottom: '{docus.landing.sectionHeader.subtitle.marginBottom}',
letterSpacing: '{docus.landing.sectionHeader.subtitle.letterSpacing}',
},
'.title': {
width: '{docus.landing.sectionHeader.title.width}',
marginBottom: '{docus.landing.sectionHeader.title.marginBottom}',
fontSize: '{docus.landing.sectionHeader.title.fontSize}',
lineHeight: '{docus.landing.sectionHeader.title.lineHeight}',
fontWeight: '{docus.landing.sectionHeader.title.fontWeight}',
letterSpacing: '{docus.landing.sectionHeader.title.letterSpacing}',
color: '{docus.landing.sectionHeader.title.color}',
gradientText: '{docus.landing.sectionHeader.title.gradientText}',
},
})
</style>
Loading

0 comments on commit 8248502

Please sign in to comment.