No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

RatingModal

評價對話框元件,封裝自 Ant DesignModal 元件。

設計稿 https://zpl.io/V153P9Q

Usage

import { RatingModal } from '@hahow/hahow-design';
import React, { useState } from 'react';

const App = () => {
  const [visible, setVisible] = useState(false);

  const showModal = () => setVisible(true);
  const handleCancel = () => setVisible(false);

  return (
    <>
      <Button onClick={showModal}>Open Modal</Button>
      <RatingModal onCancel={handleCancel} visible={visible} />
    </>
  );
}
NameDescriptionDefault
onCancel
點擊遮罩層或右上角叉或取消按鈕的 callback
func
"null"
onRatingChange
點擊評分的 callback,第一個參數為評分
func
"null"
onReviewSubmit
點擊送出表單的 callback,第一個參數為 { title: string, description: string }
func
"null"
rating
當前評分數
1 | 2 | 3 | 4 | 5
"null"
renderFooter
評價表單底部內容 第一個參數為 { onOk: func, onCancel: func } 回傳格式詳見 Ant Design Model 元件的 `props.footer`
func
"({ onOk }) => [\n <Button key=\"submit\" onClick={onOk}>\n 送出\n </Button>,\n]"
review
評價 { title: 標題, description: 內容 }
{ title: string, description: string }
"null"
reviewFormDescription
評價表單內容文字
string
"'內容(選填)'"
reviewFormDescriptionPlaceholder
評價表單內容 placeholder 文字
string
"'這堂課哪些地方對你來說最有幫助呢?有哪些特別有收穫的地方呢?和其他人分享你的學習心得吧'"
reviewFormTitle
評價表單標題文字
string
"'標題(選填)'"
reviewFormTitlePlaceholder
評價表單標題 placeholder 文字
string
"'用一句話總結你的心得吧'"
subtitle
對話框子標題
string
"'你覺得這堂課如何呢?幫助其他人更了解這堂課程'"
title
對話框標題
string
"'填寫評價'"
visible
對話框是否顯示
bool
"false"

Stories

Playground

注意切換至 Canvas tab 即可透過 Knobs 調整 props,以及 Actions 查看 callback function 的 payload