mirror of https://gitee.com/answerdev/answer.git
fix: style adjustment
This commit is contained in:
parent
8dda61d685
commit
6626f96614
|
@ -12,6 +12,7 @@ interface Props {
|
||||||
sortKey?: string;
|
sortKey?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
pathname?: string;
|
pathname?: string;
|
||||||
|
wrapClassName?: string;
|
||||||
}
|
}
|
||||||
const MAX_BUTTON_COUNT = 3;
|
const MAX_BUTTON_COUNT = 3;
|
||||||
const Index: FC<Props> = ({
|
const Index: FC<Props> = ({
|
||||||
|
@ -21,6 +22,7 @@ const Index: FC<Props> = ({
|
||||||
i18nKeyPrefix = '',
|
i18nKeyPrefix = '',
|
||||||
className = '',
|
className = '',
|
||||||
pathname = '',
|
pathname = '',
|
||||||
|
wrapClassName = '',
|
||||||
}) => {
|
}) => {
|
||||||
const [searchParams, setUrlSearchParams] = useSearchParams();
|
const [searchParams, setUrlSearchParams] = useSearchParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
@ -51,7 +53,7 @@ const Index: FC<Props> = ({
|
||||||
return (typeof btn === 'string' ? btn : btn.name) === currentSort;
|
return (typeof btn === 'string' ? btn : btn.name) === currentSort;
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<ButtonGroup size="sm">
|
<ButtonGroup size="sm" className={wrapClassName}>
|
||||||
{data.map((btn, index) => {
|
{data.map((btn, index) => {
|
||||||
const key = typeof btn === 'string' ? btn : btn.sort;
|
const key = typeof btn === 'string' ? btn : btn.sort;
|
||||||
const name = typeof btn === 'string' ? btn : btn.name;
|
const name = typeof btn === 'string' ? btn : btn.name;
|
||||||
|
@ -62,7 +64,7 @@ const Index: FC<Props> = ({
|
||||||
variant="outline-secondary"
|
variant="outline-secondary"
|
||||||
active={currentSort === name}
|
active={currentSort === name}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'text-capitalize',
|
'text-capitalize fit-content',
|
||||||
data.length > MAX_BUTTON_COUNT &&
|
data.length > MAX_BUTTON_COUNT &&
|
||||||
index > MAX_BUTTON_COUNT - 2 &&
|
index > MAX_BUTTON_COUNT - 2 &&
|
||||||
'd-none d-md-block',
|
'd-none d-md-block',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { FC } from 'react';
|
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 { NavLink, useParams, useSearchParams } from 'react-router-dom';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
@ -103,23 +103,19 @@ const QuestionList: FC<Props> = ({ source }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Row className="mb-3">
|
<div className="mb-3 d-flex flex-wrap justify-content-between">
|
||||||
<Col className="d-flex align-items-center">
|
|
||||||
<h5 className="fs-5 text-nowrap mb-3 mb-md-0">
|
<h5 className="fs-5 text-nowrap mb-3 mb-md-0">
|
||||||
{source === 'questions'
|
{source === 'questions'
|
||||||
? t('all_questions')
|
? t('all_questions')
|
||||||
: t('x_questions', { count })}
|
: t('x_questions', { count })}
|
||||||
</h5>
|
</h5>
|
||||||
</Col>
|
|
||||||
<Col>
|
|
||||||
<QueryGroup
|
<QueryGroup
|
||||||
data={QuestionOrderKeys}
|
data={QuestionOrderKeys}
|
||||||
currentSort={curOrder}
|
currentSort={curOrder}
|
||||||
pathname={source === 'questions' ? '/questions' : ''}
|
pathname={source === 'questions' ? '/questions' : ''}
|
||||||
i18nKeyPrefix="question"
|
i18nKeyPrefix="question"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</div>
|
||||||
</Row>
|
|
||||||
<ListGroup variant="flush" className="border-top border-bottom-0">
|
<ListGroup variant="flush" className="border-top border-bottom-0">
|
||||||
{listData?.list?.map((li) => {
|
{listData?.list?.map((li) => {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -141,6 +141,11 @@ a {
|
||||||
background-color: #fff3cd80;
|
background-color: #fff3cd80;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fit-content {
|
||||||
|
height: fit-content;
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
// fix bug for React-Bootstrap Form.Text
|
// fix bug for React-Bootstrap Form.Text
|
||||||
.form-text {
|
.form-text {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
Loading…
Reference in New Issue