# patchkit-msg-view

> Render individual SSB messages. Useful alone, or in msg-list/msg-thread

Latest version **1.2.0** (published 2016-07-07) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install patchkit-msg-view
pnpm add patchkit-msg-view
yarn add patchkit-msg-view
bun add patchkit-msg-view
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-07-07 |
| First published | 2016-04-08 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 16 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Paul Frazee |
| Maintainers | pfraze |
| Keywords | react |

## Links

- npm: https://www.npmjs.com/package/patchkit-msg-view
- Repository: https://github.com/patchkit/patchkit-msg-view
- Homepage: https://github.com/patchkit/patchkit-msg-view#readme
- Issues: https://github.com/patchkit/patchkit-msg-view/issues
- npm.io page: https://npm.io/package/patchkit-msg-view

## Dependencies (16)

- [react](https://npm.io/package/react.md) ^0.14.6
- [multicb](https://npm.io/package/multicb.md) ^1.2.1
- [ssb-ref](https://npm.io/package/ssb-ref.md) ^2.3.0
- [ssb-msgs](https://npm.io/package/ssb-msgs.md) ^5.2.0
- [classnames](https://npm.io/package/classnames.md) ^2.2.3
- [image-loaded](https://npm.io/package/image-loaded.md) 0.0.2
- [patchkit-links](https://npm.io/package/patchkit-links.md) ^1.0.1
- [patchkit-modal](https://npm.io/package/patchkit-modal.md) ^1.1.0
- [patchkit-dropdown](https://npm.io/package/patchkit-dropdown.md) ^1.0.0
- [patchkit-markdown](https://npm.io/package/patchkit-markdown.md) ^1.0.1
- [patchkit-nicedate](https://npm.io/package/patchkit-nicedate.md) ^1.0.0
- [patchwork-threads](https://npm.io/package/patchwork-threads.md) ^2.2.0
- [react-clipboard.js](https://npm.io/package/react-clipboard.js.md) ^0.1.7
- [patchkit-msg-content](https://npm.io/package/patchkit-msg-content.md) ^1.0.0
- [patchkit-form-flag-msg](https://npm.io/package/patchkit-form-flag-msg.md) ^1.0.0
- [patchwork-translations](https://npm.io/package/patchwork-translations.md) ^1.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2016-07-07
- 1.1.1 — 2016-04-08
- 1.1.0 — 2016-04-08
- 1.0.0 — 2016-04-08

## README

# Message Views

Render individual SSB messages. Useful alone, or in msg-list/msg-thread.

![screenshot1.png](screenshot1.png)
![screenshot2.png](screenshot2.png)
![screenshot3.png](screenshot3.png)

```jsx
import { Card, Oneline, Notification } from 'patchkit-msg-view'
// or:
import Card from 'patchkit-msg-view/card'
import Oneline from 'patchkit-msg-view/oneline'
import Notification from 'patchkit-msg-view/notification'

const onSelect = msg => {...}
const onToggleStar = msg => {...}
const onFlag = (msg, reason) => {...}

<Card
  msg={m}
  onToggleStar={onToggleStar}

  // optional:
  onSelect={onSelect}
  forceRaw={true|false}
  selectiveUpdate={true|false}
  onFlag={onFlag}
  forceExpanded={true|false}
  listView={true|false} />

<Oneline
  msg={m}

  // optional:
  onSelect={onSelect}
  forceRaw={true|false}
  selectiveUpdate={true|false} />

<Notification
  msg={m}
  onToggleStar={onToggleStar} />
```

Options:

 - `msg`: Required. The ssb message object
 - `onToggleStar`: Called when dig button is hit. Should publish the vote message.
 - `onFlag`: Called when a flag is published (`reason` is a string) or unpublished (`reason` is falsey). Should publish the vote message.
 - `onSelect`: Optional, called when the message is opened.
 - `forceRaw`: Render as raw data? ("Force" because usually raw is only used for unknown message types.)
 - `forceExpanded`: Automatically expand card?
 - `listView`: Render the card in listview mode?
 - `selectiveUpdate`: Use a change counter on the message to control shouldComponentUpdate? (Helps with performance.)


## Styles

Use the .less file:

```less
@import "node_modules/patchkit-msg-view/styles.less"
```

Or individual:

```less
@import "node_modules/patchkit-msg-view/card.less"
@import "node_modules/patchkit-msg-view/oneline.less"
@import "node_modules/patchkit-msg-view/notifiction.less"
```

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