content-rating
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Screen shots

Screenshots of design

Usage

// version @next compatible with react 17 and Mui version 5.0.0-rc.1
// size ~= 7.7kb
import { openContentRating } from 'content-rating/@next'
// or
import openContentRating from 'content-rating/@next'

// version v4 compatible with react >=16.8 and no material needed
// size ~= 150kb
import { openContentRating } from 'content-rating/@bundled'
// or
import openContentRating from 'content-rating/@bundled'

type and Data

const t = {
  title: 'این محتوا را چگونه ارزیابی میکنید؟',
  submitText: 'ثبت',
  ratingFeedback: {
    1: 'با کمک شما محصول بهتری خواهیم شد',
    2: 'با کمک شما محصول بهتری خواهیم شد',
    3: 'ارزیابی شما ثبت شد، با تشکر',
    4: 'ارزیابی شما ثبت شد، با تشکر',
    5: 'ارزیابی شما ثبت شد، با تشکر',
  },
}

export type Rate = 1 | 2 | 3 | 4 | 5

export type SideEffectFunction = () => {}

export interface ContentRateProps {
  title?: typeof t['title']
  submitText?: typeof t['submitText']
  destroyDelay?: number
  onClose?: SideEffectFunction
  onSubmit?: (rate: Rate) => Promise<void>
  onDestroy: SideEffectFunction
  ratingFeedback?: typeof t['ratingFeedback']
}

exported functions

type openContentRating = async (
  instance: string,
  config: ContentRateProps) => Promise<void>

TODO:

  • [ ] add compatible version 4 using mui/lab to shrink code size

/content-rating/

    Package Sidebar

    Install

    npm i content-rating

    Homepage

    .

    Weekly Downloads

    1

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    170 kB

    Total Files

    22

    Last publish

    Collaborators

    • amirhe