Remove hide/show behaviour

This commit is contained in:
Will Hunt 2020-11-30 12:47:27 +00:00
parent 8e6061b37a
commit 8d203043d4
2 changed files with 15 additions and 35 deletions

View file

@ -89,24 +89,18 @@ limitations under the License.
} }
} }
.mx_showMore {
display: block;
text-align: left;
margin-top: 10px;
}
.metadata { .metadata {
color: $muted-fg-color; color: $muted-fg-color;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-bottom: 0; margin-bottom: 0;
}
.metadata.visible {
overflow-y: visible; overflow-y: visible;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: normal; white-space: normal;
padding: 0;
> li {
padding: 0;
border: 0;
}
} }
} }
} }

View file

@ -33,26 +33,16 @@ interface IProps {
room: Room; room: Room;
} }
interface IState { /**
visible: boolean;
} }
@replaceableComponentTs("views.settings.BridgeTile") @replaceableComponentTs("views.settings.BridgeTile")
export default class BridgeTile extends React.PureComponent<IProps, IState> { export default class BridgeTile extends React.PureComponent<IProps> {
static propTypes = { static propTypes = {
ev: PropTypes.object.isRequired, ev: PropTypes.object.isRequired,
room: PropTypes.object.isRequired, room: PropTypes.object.isRequired,
} }
state = {
visible: false,
}
_toggleVisible() {
this.setState({
visible: !this.state.visible,
});
}
render() { render() {
const content = this.props.ev.getContent(); const content = this.props.ev.getContent();
@ -63,24 +53,24 @@ export default class BridgeTile extends React.PureComponent<IProps, IState> {
let creator = null; let creator = null;
if (content.creator) { if (content.creator) {
creator = _t("This bridge was provisioned by <user />.", {}, { creator = <li>{_t("This bridge was provisioned by <user />.", {}, {
user: () => <Pill user: () => <Pill
type={Pill.TYPE_USER_MENTION} type={Pill.TYPE_USER_MENTION}
room={this.props.room} room={this.props.room}
url={makeUserPermalink(content.creator)} url={makeUserPermalink(content.creator)}
shouldShowPillAvatar={SettingsStore.getValue("Pill.shouldShowPillAvatar")} shouldShowPillAvatar={SettingsStore.getValue("Pill.shouldShowPillAvatar")}
/>, />,
}); })}</li>;
} }
const bot = _t("This bridge is managed by <user />.", {}, { const bot = <li>{_t("This bridge is managed by <user />.", {}, {
user: () => <Pill user: () => <Pill
type={Pill.TYPE_USER_MENTION} type={Pill.TYPE_USER_MENTION}
room={this.props.room} room={this.props.room}
url={makeUserPermalink(this.props.ev.getSender())} url={makeUserPermalink(content.bridgebot)}
shouldShowPillAvatar={SettingsStore.getValue("Pill.shouldShowPillAvatar")} shouldShowPillAvatar={SettingsStore.getValue("Pill.shouldShowPillAvatar")}
/>, />,
}); })}</li>;
let networkIcon; let networkIcon;
@ -103,7 +93,6 @@ export default class BridgeTile extends React.PureComponent<IProps, IState> {
} }
const id = this.props.ev.getId(); const id = this.props.ev.getId();
const metadataClassname = "metadata" + (this.state.visible ? " visible" : "");
return (<li key={id}> return (<li key={id}>
<div className="column-icon"> <div className="column-icon">
{networkIcon} {networkIcon}
@ -114,12 +103,9 @@ export default class BridgeTile extends React.PureComponent<IProps, IState> {
<span>{_t("Workspace: %(networkName)s", {networkName})}</span> <span>{_t("Workspace: %(networkName)s", {networkName})}</span>
<span className="channel">{_t("Channel: %(channelName)s", {channelName})}</span> <span className="channel">{_t("Channel: %(channelName)s", {channelName})}</span>
</p> </p>
<p className={metadataClassname}> <ul className="metadata">
{creator} {bot} {creator} {bot}
</p> </ul>
<AccessibleButton className="mx_showMore" kind="secondary" onClick={this._toggleVisible.bind(this)}>
{ this.state.visible ? _t("Show less") : _t("Show more") }
</AccessibleButton>
</div> </div>
</li>); </li>);
} }