Skip to content

Commit

Permalink
Bump version to v2 final. Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastián Veggiani (Tian) committed Feb 20, 2023
1 parent beeeab1 commit fb996a2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 24 deletions.
70 changes: 47 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# react-telegram-comments
# react-telegram-comments v2

[![NPM version][npm-image]][npm-url]
[![Build][github-build]][github-build-url]
![npm-typescript]
[![License][github-license]][github-license-url]

A really simple React component/library to allow website visitors to comment and interact with others using their Telegram's account.

Expand All @@ -11,36 +16,31 @@ References:

The main motivation for this component is to a provide a lightweight alternative to Discord (and similar services) to handle comments in websites.

[See it in action!](https://actionauta.com/notes/integrating-tailwind-css-modules-sass-stylelint-nextjs)
See it in action!:

- [Example page](https://sveggiani.github.io/react-telegram-comments)
- [On my personal website](https://actionauta.com/notes/integrating-tailwind-css-modules-sass-stylelint-nextjs)

## Comments.app Features

- Light / Dark themes
- Light and dark themes
- Customization for UI colors and icons
- Allow to reply to comments
- Like or dislike options
- Customize the number of comments to show
- Ability to add other users as Administrators or Moderators
- Ability to delete comments and ban users
- Suscribe to comments (using your Telegram account and [@discussbot](https://t.me/discussbot))
- Created by [Telegram](https://telegram.org) :blue_heart:

## To-Do

- [ ] Add some tests
- [x] Add prop for custom height
- [x] Add prop for different color names
- [x] Add prop for custom colors
- [x] Add prop for icon outlines
- [x] Write better documentation
_Created by [Telegram](https://telegram.org)_ :blue_heart:

## How to Use

1. Sign-up to [comments.app](https://comments.app), add your site and get a valid _Site ID_ for your domain.
2. Add the component package to your project with `yarn add react-telegram-comments` or `npm install react-telegram-comments`.
3. Import the component in your pages or components:
```javascript
import TelegramComments from "react-telegram-comments";
import { TelegramComments } from "react-telegram-comments";
```
4. Add `TelegramComments` to your component or page:

Expand All @@ -50,38 +50,62 @@ The main motivation for this component is to a provide a lightweight alternative
export default Comments;
```

5. Done

_Important:_ Have in mind that for the moment the widget doesn't work with local domains. You'll need to publish your application to see it in action.
_Important:_ Have in mind that for the moment the widget doesn't work with local domains. You'll need to publish your website to see it in action.

## Configuration and Customization Using Props

- `commentsNumber` _{number}_ _optional_ The number of comments to display (`5`)
- `containerClassName`: _{string}_ _optional_ The components main container class (`"telegram-comments"`)
- `customColor` _{string}_ _optional_ Highlight color, hex value without # (`null`)
- `customHeight` _{number}_ _optional_ Custom widget height in pixels (`null`)
- `commentsNumber` _{number}_ _optional_ The number of comments to display (`5`)
- `isDark` _{boolean}_ _optional_ Use dark theme (`false`)
- `onLoad`: _{}_ _optional_ Callback function to be executed when the external script is loaded
- `pageId` _{string}_ _optional_ Unique identifier of the page. Page URL by default (`null`)
- `showColorfulNames` _{boolean}_ _optional_ Use different color for usernames (`false`)
- `showDislikes` _{boolean}_ _optional_ Add the dislike option for comments (`true`)
- `showIconOutlines` _{boolean}_ _optional_ Display outlined icons (`false`)
- `useDarkMode` _{boolean}_ _optional_ Use dark theme (`false`)
- `websiteKey`: _{string}_ _required_ The Site ID
- `containerClassName`: _{string}_ _optional_ The components main container class (`"telegram-comments"`)
- `wrapperClassName`: _{string}_ _optional_ The inner wrapper class, in case you need another one (`"telegram-comments__wrapper"`)
- `wrapperClassName`: _{string}_ _optional_ The inner wrapper class, in case you need another one (E.g. `"telegram-comments__wrapper"`)

### Full Example

```javascript
<TelegramComments
customColor="fb9f9f"
customHeight="450"
commentsNumber={3}
containerClassName="awesome-comments"
customColor="663399"
customHeight="450"
isDark
onLoad={() => console.log("Comments loaded!")}
pageId="about-page"
showColorfulNames
showDislikes
showIconOutlines
websiteKey={process.env.COMMENTS_APP_KEY}
containerClassName="awesome-comments"
wrapperClassName="awesome-comments__wrapper"
/>
```

### Change log

#### v2.0.0

- Rewrite component using modern TypeScript and React.
- New, simplified build system using `tsc` only.
- Automatted builds and NPM publish using github actions.
- Add unitary tests (finally!).
- Enhanced documentation and demo page added.
- `isDark` prop renamed to `useDarkMode` (only breaking change from v1)
- Add `onLoad` callback prop

---

[npm-url]: https://www.npmjs.com/package/react-telegram-comments
[npm-image]: https://img.shields.io/npm/v/react-telegram-comments
[github-license]: https://img.shields.io/github/license/sveggiani/react-telegram-comments
[github-license-url]: https://github.com/sveggiani/react-telegram-comments/blob/master/LICENSE
[github-build]: https://github.com/sveggiani/react-telegram-comments/actions/workflows/publish.yml/badge.svg
[github-build-url]: https://github.com/sveggiani/react-telegram-comments/actions/workflows/publish.yml
[npm-typescript]: https://img.shields.io/npm/types/react-telegram-comments

Proudly made in :argentina:
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-telegram-comments",
"version": "2.0.0-beta.6",
"version": "2.0.0",
"description": "A simple React component/librarty to integrate comments using Telegram's comments.app",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
Expand Down

0 comments on commit fb996a2

Please sign in to comment.