fix: #1000, optimize tag list layout

This commit is contained in:
haitao(lj) 2022-10-11 16:18:47 +08:00
parent fa5134dd0f
commit 01d31ff0f1
5 changed files with 14 additions and 15 deletions

View File

@ -1,2 +1,3 @@
$link-hover-decoration: none;
$enable-negative-margins: true;
$blue: #0033FF !default;

View File

@ -68,16 +68,13 @@ const Index: FC = () => {
{t('edit')}
</Button>
</Card.Header>
<Card.Body className="pb-2">
<Card.Body className="mx-n1">
{followingTags?.length ? (
<>
{followingTags.map((item) => {
const slugName = item?.slug_name;
return (
<Tag
key={slugName}
className="me-2 mb-2"
href={`/tags/${slugName}`}>
<Tag key={slugName} className="m-1" href={`/tags/${slugName}`}>
{slugName}
</Tag>
);

View File

@ -122,7 +122,9 @@ const QuestionList: FC<Props> = ({ source }) => {
<ListGroup variant="flush" className="border-top border-bottom-0">
{listData?.list?.map((li) => {
return (
<ListGroup.Item key={li.id} className="border-bottom py-3 px-0">
<ListGroup.Item
key={li.id}
className="border-bottom pt-3 pb-2 px-0">
<h5 className="text-wrap text-break">
<NavLink to={`/questions/${li.id}`} className="link-dark">
{li.title}
@ -153,13 +155,13 @@ const QuestionList: FC<Props> = ({ source }) => {
<em className="fst-normal mx-1">{li.view_count}</em>
</span>
</div>
<div className="question-tags">
<div className="question-tags mx-n1">
{Array.isArray(li.tags)
? li.tags.map((tag) => {
return (
<Tag
key={tag.slug_name}
className="me-2 mt-2"
className="m-1"
href={`/tags/${
tag.main_tag_slug_name || tag.slug_name
}`}>

View File

@ -177,19 +177,18 @@ const TagSelector: FC<IProps> = ({
onFocus={onFocus}
onBlur={onBlur}
onKeyDown={handleKeyDown}>
<div className="d-flex flex-wrap">
<div className="d-flex flex-wrap mx-n1">
{initialValue?.map((item, index) => {
return (
<Button
key={item.slug_name}
className={classNames(
'me-2 mb-2 text-nowrap d-flex align-items-center',
'm-1 text-nowrap d-flex align-items-center',
index === repeatIndex && 'warning',
)}
variant="outline-secondary"
size="sm">
{item.slug_name}
<span className="ms-1" onMouseUp={() => handleRemove(item)}>
×
</span>
@ -199,7 +198,7 @@ const TagSelector: FC<IProps> = ({
{initialValue?.length < 5 || alwaysShowAddBtn ? (
<Dropdown onSelect={handleSelect} onToggle={setVisibleMenu}>
<Dropdown.Toggle
className={classNames(alwaysShowAddBtn ? 'mb-2' : null)}
className={classNames('m-1')}
variant="outline-secondary"
size="sm">
<span className="me-1">+</span>

View File

@ -65,7 +65,7 @@ const Index: FC<Props> = ({ data, initPage, hasAnswer }) => {
: ''}
</Link>
</h1>
<div className="d-flex align-items-center fs-14 mb-3 text-secondary">
<div className="d-flex align-items-center fs-14 mb-2 text-secondary">
<FormatTime
time={data.create_time}
preFix={t('Asked')}
@ -90,11 +90,11 @@ const Index: FC<Props> = ({ data, initPage, hasAnswer }) => {
{followed ? 'Following' : 'Follow'}
</Button>
</div>
<div className="mb-3">
<div className="mb-2 mx-n1">
{data?.tags?.map((item: any) => {
return (
<Tag
className="me-1"
className="m-1"
href={`/tags/${item.main_tag_slug_name || item.slug_name}`}
key={item.slug_name}>
{item.slug_name}