From 8ee38b0a776f71dbacc3c7dcac2385377b7cd01a Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Sat, 4 Nov 2023 23:31:01 +0600 Subject: [PATCH] Tailwind migration: fixed UI --- .../comment/__snapshots__/index.spec.tsx.snap | 4 ++-- src/common/components/proposal-votes/index.tsx | 18 +++++++++++------- .../components/suggestion-list/_index.scss | 3 ++- .../components/suggestion-list/index.tsx | 10 +++++++--- src/common/components/tag-selector/index.tsx | 11 +++++++---- src/common/features/ui/list/index.tsx | 4 +++- src/common/img/svg.tsx | 2 +- 7 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/common/components/comment/__snapshots__/index.spec.tsx.snap b/src/common/components/comment/__snapshots__/index.spec.tsx.snap index 8c13214da4b..e0ba206d0f4 100644 --- a/src/common/components/comment/__snapshots__/index.spec.tsx.snap +++ b/src/common/components/comment/__snapshots__/index.spec.tsx.snap @@ -203,7 +203,7 @@ exports[`(1) Default render 1`] = `
@@ -551,7 +551,7 @@ exports[`(2) Cancellable, in progress 1`] = `
diff --git a/src/common/components/proposal-votes/index.tsx b/src/common/components/proposal-votes/index.tsx index ef10df0406b..a7fafc9b21c 100644 --- a/src/common/components/proposal-votes/index.tsx +++ b/src/common/components/proposal-votes/index.tsx @@ -16,6 +16,7 @@ import { _t } from "../../i18n"; import "./_index.scss"; import { Modal, ModalBody, ModalHeader, ModalTitle } from "@ui/modal"; import { FormControl } from "@ui/input"; +import { List, ListItem } from "@ui/list"; interface Voter { name: string; @@ -168,6 +169,7 @@ export class ProposalVotesDetail extends BaseComponent { this.load(); } }; + render() { const { loading, voters, page, sort, originalVoters } = this.state; if (loading && !voters.length && !originalVoters.length) { @@ -190,15 +192,15 @@ export class ProposalVotesDetail extends BaseComponent { <> {loading && } -
-
+
+ {sliced && sliced.length > 0 ? ( sliced.map((x) => { const strHp = numeral(x.hp).format("0.00,"); const strProxyHp = numeral(x.proxyHp).format("0.00,"); return ( -
+
{ProfileLink({ ...this.props, @@ -227,7 +229,7 @@ export class ProposalVotesDetail extends BaseComponent { )}
-
+ ); }) ) : ( @@ -235,7 +237,7 @@ export class ProposalVotesDetail extends BaseComponent { {loading ? _t("proposals.searching") : _t("proposals.no-results")}
)} -
+
@@ -281,6 +283,7 @@ interface ProposalVotesState { voteCount: string; isMoreData: boolean; } + export class ProposalVotes extends Component { state: ProposalVotesState = { searchText: "", @@ -296,6 +299,7 @@ export class ProposalVotes extends Component { this.setState({ isMoreData: check }); }; + render() { const { proposal, onHide } = this.props; const { searchText, voteCount, isMoreData } = this.state; @@ -309,12 +313,12 @@ export class ProposalVotes extends Component - + {modalTitle + _t("proposals.votes-dialog-title", { n: proposal.id })} -
+
:first-child { position: relative; z-index: 10; } @@ -80,6 +80,7 @@ } } } + .more-result { .list-item { @include themify(day) { diff --git a/src/common/components/suggestion-list/index.tsx b/src/common/components/suggestion-list/index.tsx index af8fca3e57e..2b25d08ec42 100644 --- a/src/common/components/suggestion-list/index.tsx +++ b/src/common/components/suggestion-list/index.tsx @@ -1,9 +1,9 @@ -import React, { Component } from "react"; +import React, { Component, CSSProperties } from "react"; import { History, Location } from "history"; import { _t } from "../../i18n"; -import ClickAwayListener from "../clickaway-listener"; import "./_index.scss"; import { classNameObject } from "../../helper/class-name-object"; +import ClickAwayListener from "../clickaway-listener"; interface Props { history?: History; @@ -17,6 +17,7 @@ interface Props { children: JSX.Element; searchValue?: string; ignoreFirstInputFocus?: boolean; + listStyle?: CSSProperties; } interface State { @@ -211,7 +212,10 @@ export default class SuggestionList extends Component { this.setState({ showList: false })}> {showList && modeItems && modeItems?.length > 0 ? modeItemsUI : <>} {showList && !modeItems && items.length > 0 ? ( -
+
{header && (
{header} diff --git a/src/common/components/tag-selector/index.tsx b/src/common/components/tag-selector/index.tsx index 5349810cc07..71524a1a0d6 100644 --- a/src/common/components/tag-selector/index.tsx +++ b/src/common/components/tag-selector/index.tsx @@ -36,16 +36,16 @@ interface State { } export class TagSelector extends Component { - constructor(props: any) { - super(props); - } - state: State = { hasFocus: false, value: "", warning: "" }; + constructor(props: any) { + super(props); + } + shouldComponentUpdate(nextProps: Readonly, nextState: Readonly<{}>): boolean { return !isEqual(this.props.tags, nextProps.tags) || !isEqual(this.state, nextState); } @@ -205,6 +205,9 @@ export class TagSelector extends Component { ); }} items={suggestions} + listStyle={{ + top: "0" + }} header={_t("tag-selector.suggestion-header")} onSelect={(value: string) => { if (this.add(value)) { diff --git a/src/common/features/ui/list/index.tsx b/src/common/features/ui/list/index.tsx index e0c0ee86d25..4373ea629f7 100644 --- a/src/common/features/ui/list/index.tsx +++ b/src/common/features/ui/list/index.tsx @@ -5,6 +5,7 @@ import { useFilteredProps } from "../../../util/props-filter"; interface Props { defer?: boolean; inline?: boolean; + grid?: boolean; } export function List(props: HTMLProps & Props) { @@ -14,7 +15,8 @@ export function List(props: HTMLProps & Props) {
+