Skip to content

Commit

Permalink
Code component (#41)
Browse files Browse the repository at this point in the history
* feat: code component documentation

* refactor: change name casing code

* refactor: change name casing code
  • Loading branch information
D-Lite authored Jul 16, 2023
1 parent 308c42e commit 44c3ac2
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/content/examples/code/ColorsCode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<CStack is-inline>
<CCode>console.log(welcome)</CCode>
<CCode color-scheme="red">var chakra = 'awesome!'</CCode>
<CCode color-scheme="yellow">npm install chakra</CCode>
</CStack>
</template>
3 changes: 3 additions & 0 deletions components/content/examples/code/SimpleCode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<CCode> Hello world </CCode>
</template>
7 changes: 7 additions & 0 deletions components/content/examples/code/VariantCode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<CStack is-inline>
<CCode color-scheme="whatsapp" variant="outline">Outline </CCode>
<CCode color-scheme="whatsapp" variant="subtle">Solid </CCode>
<CCode color-scheme="whatsapp" variant="solid">Solid</CCode>
</CStack>
</template>
69 changes: 69 additions & 0 deletions content/4.components/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Code
description: Code component
version: 2.0+
---
# Code

Code is a component used to display inline code. It is composed of the `Box` component with a font family of `mono` for displaying code.

## Import

```js
import { CCode } from "@chakra-ui/vue-next"
```

## Usage

::showcase
:simple-code
::

```html
<CCode>Hello world </CCode>
```

## Colors

You can change the color scheme of the component by passing the `colorScheme` prop.

::showcase
:colors-code
::

```html
<CStack is-inline>
<CCode>console.log(welcome)</CCode>
<CCode color-scheme="red">var chakra = 'awesome!'></CCode>
<CCode color-scheme="yellow">npm install chakra</CCode>
</CStack>
```

## Variant

You can change the variant of the component by passing the `variant` prop.

::showcase
:variant-code
::

```html
<CStack is-inline>
<CCode color-scheme="whatsapp" variant="outline">Outline </CCode>
<CCode color-scheme="whatsapp" variant="subtle">Solid </CCode>
<CCode color-scheme="whatsapp" variant="solid">Solid</CCode>
</CStack>
```

## Props

| Name | Type | Default | Description |
|---------------|------------------------------------|----------|---------------------------------------|
| `colorScheme` | `string` | `grey` | The color scheme to use for the code. |
| `variant` | `"solid" \| "subtle" \| "outline"` | `subtle` | The variant of the Code |

## Slots

| Name | Description |
|---------------|---------------------------------------|
| `default` | Used for the `CCode` content. |

1 comment on commit 44c3ac2

@vercel
Copy link

@vercel vercel bot commented on 44c3ac2 Jul 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.