All Projects β†’ pfftdammitchris β†’ react-cheatsheets

pfftdammitchris / react-cheatsheets

Licence: other
Create and generate cheat sheets using React

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-cheatsheets

C Sharp Cheatsheet
C# Cheatsheet
Stars: ✭ 111 (+428.57%)
Mutual labels:  cheatsheet, cheat, cheatsheets
Pyspark Cheatsheet
🐍 Quick reference guide to common patterns & functions in PySpark.
Stars: ✭ 108 (+414.29%)
Mutual labels:  cheatsheet, cheat, cheatsheets
vue-unit-testing-cheat-sheet
πŸ”¬ My cheat sheet for testing vue components with jest and vue-test-utils
Stars: ✭ 101 (+380.95%)
Mutual labels:  cheatsheet, cheat, sheet
Arduino-Cheat-Sheet
Cheat Sheets for Arduino Programming Language
Stars: ✭ 30 (+42.86%)
Mutual labels:  cheatsheet, cheat, sheet
Kubectl Sheetcheat
The Definitive Kubectl Sheetcheat. ⭐ Give it a star if you like it. Work (always) in progress !
Stars: ✭ 119 (+466.67%)
Mutual labels:  cheatsheet, cheatsheets
memo-dev
Knowledge base, Today I Learned, Cheatsheet ... Call this as you want ...
Stars: ✭ 13 (-38.1%)
Mutual labels:  cheatsheet, cheatsheets
Cheatsheets.pdf
πŸ“š Various cheatsheets in PDF
Stars: ✭ 159 (+657.14%)
Mutual labels:  cheatsheet, cheatsheets
Huge Collection Of Cheatsheet
Share of my Huge Collection of Cheatsheet (Coding, Cheat, Pinouts, Command Lists, Etc.)
Stars: ✭ 250 (+1090.48%)
Mutual labels:  cheatsheet, cheat
Vue Cheat Sheet
πŸ“š My cheat sheet for vue.js most basic stuff https://boussadjra.github.io/vue-cheat-sheet/
Stars: ✭ 90 (+328.57%)
Mutual labels:  cheatsheet, cheat
Python Cheatsheet
Collection of Python code snippets and cheatsheets (made for humans)
Stars: ✭ 176 (+738.1%)
Mutual labels:  cheatsheet, cheat
Idiosyncratic Ruby.com
Documenting All Ruby Specialities πŸ’ŽοΈŽ
Stars: ✭ 292 (+1290.48%)
Mutual labels:  syntax, cheatsheet
dev-cheatsheets
A collection of code snippets and CLI guides for quick and easy reference while coding
Stars: ✭ 33 (+57.14%)
Mutual labels:  cheatsheet, cheatsheets
cheatsheet-python-A4
πŸ“– Advanced Python Syntax In A4
Stars: ✭ 96 (+357.14%)
Mutual labels:  syntax, cheatsheets
Active Directory Exploitation Cheat Sheet
A cheat sheet that contains common enumeration and attack methods for Windows Active Directory.
Stars: ✭ 1,392 (+6528.57%)
Mutual labels:  cheatsheet, cheat
Python Cheatsheet
Basic Cheat Sheet for Python (PDF, Markdown and Jupyter Notebook)
Stars: ✭ 1,334 (+6252.38%)
Mutual labels:  cheatsheet, cheatsheets
Javascripter
Helping junior developers navigate the complex world of software engineering without experiencing information overload.
Stars: ✭ 203 (+866.67%)
Mutual labels:  cheatsheet, cheatsheets
systems-programming-cheat-sheet
Cheat sheet for x86-64 Unix systems programming
Stars: ✭ 328 (+1461.9%)
Mutual labels:  cheatsheet, cheatsheets
Cmd Command Cheat Sheet
CMD - Command Cheat Sheat βœ…
Stars: ✭ 50 (+138.1%)
Mutual labels:  cheatsheet, cheatsheets
Algorithms Cheatsheet Resources
πŸ€“All the geeky stuffs you need to know at one place!
Stars: ✭ 60 (+185.71%)
Mutual labels:  cheatsheet, cheatsheets
Python
Python cheatsheet
Stars: ✭ 25 (+19.05%)
Mutual labels:  syntax, cheatsheet

react-csheets

Generate cheat sheets using React

Originally planned to be named react-cheatsheets but "cheat" was forbidden in the registry, so we now have react-csheets!

react-csheets thumbnail

Install

npm install --save react-csheets

Usage

This package requires React v16.9.0 or above

import React from 'react'
import Cheatsheets from 'react-csheets'

const snippets = [
  {
    id: 'snipp1',
    title: 'Fragments',
    snippet: `
// Does not support key attribute
const App = () => (
  <>
    <MyComponent />
  </>
)
// Supports key attribute
const App = () => (
  <React.Fragment key="abc123">
    <MyComponent />
  </React.Fragment>
)`,
  },
  {
    id: 'snipp2',
    title: 'Default Props',
    snippet: `
// Function component
const MyComponent = (props) => <div {...props} />
MyComponent.defaultProps = { fruit: 'apple' }

// Class component
class MyComponent extends React.Component {
  static defaultProps = { fruit: 'apple' }
  render() { return <div {...this.props} /> }
}  
`,
  },
  {
    id: 'snipp3',
    title: 'Imports / Exports',
    snippet: `
// default export
const App = (props) => <div {...props} />
export default App
import App from './App'

// named export
export const App = (props) => <div {...props} />
import { App } from './App'
`,
  },
  {
    id: 'snipp4',
    title: 'Return Types',
    snippet: `
const App = () => 'a basic string'    // string
const App = () => 1234567890          // number
const App = () => true                // boolean 
const App = () => null                // null
const App = () => <div />             // react element
const App = () => <MyComponent />     // component
const App = () => [                   // array
  'a basic string',
  1234567890,
  true,
  null,
  <div />,
  <MyComponent />,
]
`,
  },
]

const App = () => {
  function onDragEnd(rows) {
    console.log('new rows: ', rows)
  }

  return (
    <Cheatsheets
      snippets={snippets}
      columnCount={3}
      language='jsx'
      theme='coy'
      onDragEnd={onDragEnd}
    />
  )
}

export default App

TypeScript

type Snippet = {
  id: string
  title: string
  snippet: string
}

type stylesheet =
  | 'coy'
  | 'dark'
  | 'funky'
  | 'okaidia'
  | 'solarizedlight'
  | 'tomorrow'
  | 'twilight'
  | 'prism'
  | 'atomDark'
  | 'base16AteliersulphurpoolLight'
  | 'cb'
  | 'darcula'
  | 'duotoneDark'
  | 'duotoneEarth'
  | 'duotoneForest'
  | 'duotoneLight'
  | 'duotoneSea'
  | 'duotoneSpace'
  | 'ghcolors'
  | 'hopscotch'
  | 'pojoaque'
  | 'vs'
  | 'xonokai'

type RenderHeader = ({ title?: React.ReactNode, isDragging: boolean, index: number }) => React.ReactNode

type RenderSnippet ({ snippet: string, popup: Popup, index: number, isDragging: boolean }) => React.ReactNode

type RenderActions = ({ snippet: string, index: number, isDragging: boolean }) => React.ReactNode

Props

Prop Type Default Description
snippets (Required) Snippet[] undefined An array of Snippet objects. Before it gets sent to the interface it will go through a final formatting stage in which the output becomes an array of arrays of snippet objects.
columnCount number 3 Updates the number of columns in the cheat sheet.
language string jsx Changes the language syntax of the snippets. You can check all of the available options here.
theme string coy Changes the stylesheet of the snippets. This can dramatically change the look and feel of the cheat sheet.
onDragEnd (rows: Array<Snippet[]>) => void OnDragEnd Optional callback to call when the snippet box was dragged. The new rows will be passed in as the first argument.
renderHeader RenderHeader undefined Optionally pass this in to override the rendering of the header
renderSnippet RenderSnippet undefined Optionally pass this in to override the rendering of the snippet box
renderActions RenderActions undefined Optionally pass this in to override the rendering of action buttons/icons (shares the same block as the header)

Dependencies

  • react-beautiful-dnd
  • react-syntax-highlighter

License

MIT Β© pfftdammitchris

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].