ingred-ui
ingred-ui copied to clipboard
内包しているコンポーネントにもPropsを当てられるように
例えばこんな感じ
const FloatingTip: React.FunctionComponent<FloatingTipProps> = ({
baseElement,
positionPriority = ["right-start"],
offset = [0, 10],
isOpen,
onClose,
+ popoverProps,
children,
}) => {
const theme = useTheme();
return (
<Popover
isOpen={isOpen}
baseElement={baseElement}
positionPriority={positionPriority}
offset={offset}
+ {...popoverProps}
>
<ClickAwayListener onClickAway={onClose}>
<Styled.Container>
<Styled.ContentWrapper>{children}</Styled.ContentWrapper>
<Styled.IconWrapper onClick={onClose}>
<Icon name="close" color={theme.palette.black} />
</Styled.IconWrapper>
</Styled.Container>
</ClickAwayListener>
</Popover>
);
};
これができればデザイン側の細かい要望に対して、ライブラリの修正なしにカバーできるケースが増える。
全体を通してPropsの設計に統一がない(内包しているコンポーネントのpropsいじれるところもあればいじれないところもある)ので、いい感じにしたい
ref: #1090
TODO
- [x] FloatingTip以外に内包コンポーネントのためのPropsを露出させたいものがないか洗い出す
- [x] それぞれ対応する
- Popover>Modal
- ContextMenu>ActionButton
- FloatingTip>Popover
- Menu>Popover