react-component / react-component/trigger

[Proposal] Add topmost className prop and merge it into trigger element

オープン
#88 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
391
フォーク
245
PR マージ指標
30日以内にマージされた PR はありません

説明

Due to this issue: https://github.com/ant-design/ant-design/issues/10325, I suggest that we add className as a prop of Trigger for convenience.

Current
const props = this.props;
const children = props.children;
const child = React.Children.only(children);
const newChildProps = { key: 'trigger' };

// Merge some event handlers into `newChildProps`

const trigger = React.cloneElement(child, newChildProps);
Expected
import classNames from 'classnames';

// ...

const props = this.props;
const children = props.children;
const child = React.Children.only(children);
const newChildProps = {
    key: 'trigger',
    className: classNames(props.className, child.props.className),
};

// Merge some event handlers into `newChildProps`

const trigger = React.cloneElement(child, newChildProps);
name type default description
className string   additional className added to trigger

@yesmeck Shall I create a PR directly? Thanks.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

issue に記載されている Trigger 実装の子要素クローン処理から始め、props が trigger 要素にどのようにマージされるかを確認します。提案されているトップレベルの className の動作を追加し、子要素の className を保持したうえで、結果の trigger が両方のクラスを受け取ることを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react, typescript
領域
frontend
issue の種類
機能追加
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。