mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
Port to new Slot property passthrough
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import cn from 'classnames';
|
||||
import styles from './Menu.css';
|
||||
import { capitalize } from 'plugin-api/beta/client/utils';
|
||||
@@ -13,16 +14,19 @@ class Menu extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { slotPassthrough } = this.props;
|
||||
return (
|
||||
<div className={cn([styles.menu, 'talk-plugin-viewing-options-menu'])}>
|
||||
{Object.keys(this.categories).map(category => (
|
||||
<IfSlotIsNotEmpty
|
||||
slot={`viewingOptions${capitalize(category)}`}
|
||||
key={category}
|
||||
passthrough={slotPassthrough}
|
||||
>
|
||||
<Category
|
||||
slot={`viewingOptions${capitalize(category)}`}
|
||||
title={this.categories[category]}
|
||||
passthrough={slotPassthrough}
|
||||
/>
|
||||
</IfSlotIsNotEmpty>
|
||||
))}
|
||||
@@ -31,4 +35,8 @@ class Menu extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
Menu.propTypes = {
|
||||
slotPassthrough: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default Menu;
|
||||
|
||||
Reference in New Issue
Block a user