# react-code-space

Latest version **0.2.0** (published 2020-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-code-space
pnpm add react-code-space
yarn add react-code-space
bun add react-code-space
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-04-07 |
| First published | 2020-03-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 395.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | daltonh |
| Keywords | syntax, highlight, documentation, react, color, themes, syntax-highlight, code, snippet |

## Links

- npm: https://www.npmjs.com/package/react-code-space
- npm.io page: https://npm.io/package/react-code-space

## Dependencies (10)

- [react](https://npm.io/package/react.md) ^16.13.0
- [devicon](https://npm.io/package/devicon.md) ^2.2.0
- [prismjs](https://npm.io/package/prismjs.md) ^1.19.0
- [reprism](https://npm.io/package/reprism.md) 0.0.11
- [react-dom](https://npm.io/package/react-dom.md) ^16.13.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [react-scripts](https://npm.io/package/react-scripts.md) 3.4.0
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^9.5.0
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^4.2.4
- [@testing-library/user-event](https://npm.io/package/@testing-library/user-event.md) ^7.2.1

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2020-04-07
- 0.1.9 — 2020-04-06
- 0.1.8 — 2020-04-06
- 0.1.7 — 2020-04-06
- 0.1.6 — 2020-04-06
- 0.1.5 — 2020-04-06
- 0.1.4 — 2020-03-18
- 0.1.3 — 2020-03-18
- 0.1.2 — 2020-03-18
- 0.1.1 — 2020-03-18
- 0.1.0 — 2020-03-18

## README

<img align="right" src="https://github.com/DaltonHart/React-Code-Space/blob/master/assets/codespace.png?raw=true" alt="logo"  width="200px"/>

# React Code Space
React Code Space is a stylized code syntax highlighter for your documentation/ lesson building.

![](https://img.shields.io/npm/l/react-code-space?style=for-the-badge)
![](https://img.shields.io/npm/v/react-code-space?style=for-the-badge)


## Code

Code is the base import. It will recieve the below compound components for formatting your code.
<p align="center">
  <img src="https://github.com/DaltonHart/React-Code-Space/blob/master/assets/basic_dark.png?raw=true" alt="basic dark" width="800px" >

  <img src="https://github.com/DaltonHart/React-Code-Space/blob/master/assets/basic_light.png?raw=true" alt="basic light" width="800px">
<p>

```js
import Code from 'react-code-space';

function App() {
  return <Code></Code>;
}

export default App;
```

### Code props

| Name     | Description                                         | Options                            | Usage                               |
| -------- | --------------------------------------------------- | ---------------------------------- | ----------------------------------- |
| language | sets the language of the code space                 | javascript, jsx, css, scss, html   | `<Code language="jsx">`             |
| dark     | set the type of code space to dark                  | default is true                    | `<Code dark>`                       |
| light    | set the type of code space to light                 | default is true                    | `<Code light>`                      |
| theme    | set the syntax theme of the code space              | material, monokai, xonokai         | `<Code theme="monokai">`            |
| icon     | adds an icon of the language. default is language.  | react, javascript, css, scss, html | `<Code icon>`, `<Code icon="css"/>` |
| shadow   | adds a shadow to the code space                     | default is true                    | `<Code shadow>`                     |
| neomorph | adds a neomorphism design effect to the code space. | default is true                    | `<Code neomorph>`                   |
| rounded   | adds a border radius to the code space              | default is true                    | `<Code rounded>`                    |

## Code Header

Header can recieve any child and output it in a small container within the Code Space;

```js
import Code from 'react-code-space';

function App() {
  return (
    <Code dark theme='material' language='javascript'>
      <Code.Header>A lovely Header!</Code.Header>
    </Code>
  );
}

export default App;
```

## Code Body

Body is the syntax highlighting portion of the code space. This allows multiple code blocks within a code space.

```js
import Code from 'react-code-space';

const codeString = '//Your code here!';

function App() {
  return (
    <Code dark theme='material' language='javascript'>
      <Code.Header>A lovely Header!</Code.Header>
      <Code.Body content={codeString} />
    </Code>
  );
}

export default App;
```

### Body Props

| Name            | Description                                       | Options                                    | Usage                                                                 |
| --------------- | ------------------------------------------------- | ------------------------------------------ | --------------------------------------------------------------------- |
| content         | recieves a string of code to display              | a string                                   | `<Code.Body content={codeString} />`                                  |
| numbered        | adds line numbers to code output                  | default is true                            | `<Code.Body numbered/>`                                               |
| start           | starting point for line numbers                   | default is 1. Will recieve any number      | `<Code.Body numbered start={17}/>`                                    |
| highlight       | accepts string numbers to highlight lines of code | string of line numbers. will accept ranges | `<Code.Body highlight={"4"} />`,`<Code.Body content={"4,8-11,16"} />` |
| collapsable     | makes the code body an animated dropdown          | default is true                            | `<Code.Body collapsable />`                                           |
| collapsableText | sets the text for the animated dropdown           | a string                                   | `<Code.Body collapsableText={"Here is the code!"} />`                 |
| copy            | adds a copy to clipboard functionality            | default is true                            | `<Code.Body copy />`                                                  |
| blur            | adds a blurred effect to reveal on hover          | default is true                            | `<Code.Body blur />`                                                  |

<p align="center">
  <img src="https://github.com/DaltonHart/React-Code-Space/blob/master/assets/body_dark.png?raw=true" alt="dark doc" width="800px" >
<p>

## Code Doc

Doc is an embedded slot in the code space to add detailed text inline with the code space.

```js
import Code from 'react-code-space';

const codeString = '//Your code here!';

function App() {
  return (
    <Code dark theme='material' language='javascript'>
      <Code.Header>A lovely Header!</Code.Header>
      <Code.Body content={codeString} />
      <Code.Doc>Some simple text explaining the code above or below.</Code.Doc>
    </Code>
  );
}

export default App;
```

<p align="center">
  <img src="https://github.com/DaltonHart/React-Code-Space/blob/master/assets/dark_code_doc.png?raw=true" alt="dark doc" width="800px" >
<p>

## Code Divider

Divider is a simple split to seperate the code blocks with a themed horizontal rule. This can also be styled with three dots with the dots property.

### Divider Props

| Name | Description                     | Options         | Usage                  |
| ---- | ------------------------------- | --------------- | ---------------------- |
| dots | changes the style to three dots | default is true | `<Code.Divider dots/>` |


<p align="center">
  <img src="https://github.com/DaltonHart/React-Code-Space/blob/master/assets/dark_divider.png?raw=true" alt="dark doc" width="800px" >
<p>

---
_Source: https://npm.io/package/react-code-space · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
