From 6626f966145a4ce82ca56704c5a0fd88b37d8939 Mon Sep 17 00:00:00 2001 From: shuai Date: Wed, 9 Nov 2022 10:22:52 +0800 Subject: [PATCH] fix: style adjustment --- ui/src/components/QueryGroup/index.tsx | 6 +++-- ui/src/components/QuestionList/index.tsx | 32 +++++++++++------------- ui/src/index.scss | 5 ++++ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ui/src/components/QueryGroup/index.tsx b/ui/src/components/QueryGroup/index.tsx index 15c3ad49..f69e3596 100644 --- a/ui/src/components/QueryGroup/index.tsx +++ b/ui/src/components/QueryGroup/index.tsx @@ -12,6 +12,7 @@ interface Props { sortKey?: string; className?: string; pathname?: string; + wrapClassName?: string; } const MAX_BUTTON_COUNT = 3; const Index: FC = ({ @@ -21,6 +22,7 @@ const Index: FC = ({ i18nKeyPrefix = '', className = '', pathname = '', + wrapClassName = '', }) => { const [searchParams, setUrlSearchParams] = useSearchParams(); const navigate = useNavigate(); @@ -51,7 +53,7 @@ const Index: FC = ({ return (typeof btn === 'string' ? btn : btn.name) === currentSort; }); return ( - + {data.map((btn, index) => { const key = typeof btn === 'string' ? btn : btn.sort; const name = typeof btn === 'string' ? btn : btn.name; @@ -62,7 +64,7 @@ const Index: FC = ({ variant="outline-secondary" active={currentSort === name} className={classNames( - 'text-capitalize', + 'text-capitalize fit-content', data.length > MAX_BUTTON_COUNT && index > MAX_BUTTON_COUNT - 2 && 'd-none d-md-block', diff --git a/ui/src/components/QuestionList/index.tsx b/ui/src/components/QuestionList/index.tsx index 469a6e58..a45cd401 100644 --- a/ui/src/components/QuestionList/index.tsx +++ b/ui/src/components/QuestionList/index.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { Row, Col, ListGroup } from 'react-bootstrap'; +import { ListGroup } from 'react-bootstrap'; import { NavLink, useParams, useSearchParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; @@ -103,23 +103,19 @@ const QuestionList: FC = ({ source }) => { return (
- - -
- {source === 'questions' - ? t('all_questions') - : t('x_questions', { count })} -
- - - - -
+
+
+ {source === 'questions' + ? t('all_questions') + : t('x_questions', { count })} +
+ +
{listData?.list?.map((li) => { return ( diff --git a/ui/src/index.scss b/ui/src/index.scss index b225a924..097dafa0 100644 --- a/ui/src/index.scss +++ b/ui/src/index.scss @@ -141,6 +141,11 @@ a { background-color: #fff3cd80; } +.fit-content { + height: fit-content; + flex: none; +} + // fix bug for React-Bootstrap Form.Text .form-text { display: inline-block;