diff --git a/res/css/structures/_TagPanel.scss b/res/css/structures/_TagPanel.scss index 6c85341aaf..e7f67c8ace 100644 --- a/res/css/structures/_TagPanel.scss +++ b/res/css/structures/_TagPanel.scss @@ -75,6 +75,7 @@ limitations under the License. .mx_TagPanel .mx_TagTile { // opacity: 0.5; position: relative; + padding: 3px; } .mx_TagPanel .mx_TagTile:focus, .mx_TagPanel .mx_TagTile:hover, @@ -82,6 +83,45 @@ limitations under the License. // opacity: 1; } +.mx_TagPanel .mx_TagTile.mx_TagTile_selected_prototype { + background-color: $primary-bg-color; + border-radius: 6px; +} + +.mx_TagTile_selected_prototype { + .mx_TagTile_homeIcon::before { + background-color: $primary-fg-color; // dark-on-light + } +} + +.mx_TagTile:not(.mx_TagTile_selected_prototype) .mx_TagTile_homeIcon { + background-color: $icon-button-color; // XXX: Variable abuse + border-radius: 48px; + + &::before { + background-color: $primary-bg-color; // light-on-grey + } +} + +.mx_TagTile_homeIcon { + width: 32px; + height: 32px; + position: relative; + + &::before { + mask-image: url('$(res)/img/element-icons/home.svg'); + mask-position: center; + mask-repeat: no-repeat; + width: 21px; + height: 21px; + content: ''; + display: inline-block; + position: absolute; + top: calc(50% - 10.5px); + left: calc(50% - 10.5px); + } +} + .mx_TagPanel .mx_TagTile_plus { margin-bottom: 12px; height: 32px; @@ -116,10 +156,6 @@ limitations under the License. border-radius: 0 3px 3px 0; } -.mx_TagPanel .mx_TagTile.mx_TagTile_large.mx_TagTile_selected::before { - left: -10px; -} - .mx_TagPanel .mx_TagTile.mx_AccessibleButton:focus { filter: none; } diff --git a/res/img/element-icons/home.svg b/res/img/element-icons/home.svg new file mode 100644 index 0000000000..d65812cafd --- /dev/null +++ b/res/img/element-icons/home.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/views/elements/TagTile.js b/src/components/views/elements/TagTile.js index 49b336a577..562a478976 100644 --- a/src/components/views/elements/TagTile.js +++ b/src/components/views/elements/TagTile.js @@ -141,9 +141,11 @@ export default createReactClass({ profile.avatarUrl, avatarHeight, avatarHeight, "crop", ) : null; + const isPrototype = SettingsStore.getValue("feature_communities_v2_prototypes"); const className = classNames({ mx_TagTile: true, - mx_TagTile_selected: this.props.selected, + mx_TagTile_selected: this.props.selected && !isPrototype, + mx_TagTile_selected_prototype: this.props.selected && isPrototype, }); const badge = TagOrderStore.getGroupBadge(this.props.tag); diff --git a/src/components/views/elements/UserTagTile.tsx b/src/components/views/elements/UserTagTile.tsx index c652423753..635c537324 100644 --- a/src/components/views/elements/UserTagTile.tsx +++ b/src/components/views/elements/UserTagTile.tsx @@ -16,16 +16,14 @@ limitations under the License. import React from "react"; import defaultDispatcher from "../../../dispatcher/dispatcher"; -import { OwnProfileStore } from "../../../stores/OwnProfileStore"; -import { UPDATE_EVENT } from "../../../stores/AsyncStore"; import * as fbEmitter from "fbemitter"; import TagOrderStore from "../../../stores/TagOrderStore"; import AccessibleTooltipButton from "./AccessibleTooltipButton"; -import BaseAvatar from "../avatars/BaseAvatar"; -import { MatrixClientPeg } from "../../../MatrixClientPeg"; import classNames from "classnames"; +import { _t } from "../../../languageHandler"; -interface IProps{} +interface IProps { +} interface IState { selected: boolean; @@ -43,18 +41,13 @@ export default class UserTagTile extends React.PureComponent { } public componentDidMount() { - OwnProfileStore.instance.on(UPDATE_EVENT, this.onProfileUpdate); this.tagStoreRef = TagOrderStore.addListener(this.onTagStoreUpdate); } public componentWillUnmount() { - OwnProfileStore.instance.off(UPDATE_EVENT, this.onProfileUpdate); + this.tagStoreRef.remove(); } - private onProfileUpdate = () => { - this.forceUpdate(); - }; - private onTagStoreUpdate = () => { const selected = TagOrderStore.getSelectedTags().length === 0; this.setState({selected}); @@ -71,27 +64,19 @@ export default class UserTagTile extends React.PureComponent { public render() { // XXX: We reuse TagTile classes for ease of demonstration - we should probably generify // TagTile instead if we continue to use this component. - const avatarHeight = 36; - const name = OwnProfileStore.instance.displayName || MatrixClientPeg.get().getUserId(); const className = classNames({ mx_TagTile: true, - mx_TagTile_selected: this.state.selected, - mx_TagTile_large: true, + mx_TagTile_selected_prototype: this.state.selected, + mx_TagTile_home: true, }); return (
- +
);