Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

refactor: Responsive styling

robinc2e48bd15246
diff --git a/ui/src/components/Comment/components/ActionBar/index.tsx b/ui/src/components/Comment/components/ActionBar/index.tsx
index b8d75639..a801a6bb 100644
--- a/ui/src/components/Comment/components/ActionBar/index.tsx
+++ b/ui/src/components/Comment/components/ActionBar/index.tsx
@@ -1,5 +1,5 @@
import { memo } from 'react';
-import { Button } from 'react-bootstrap';
+import { Button, Dropdown } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
@@ -64,6 +64,29 @@ const ActionBar = ({
);
})}
</div>
+ <Dropdown className="d-block d-md-none">
+ <Dropdown.Toggle
+ as="div"
+ variant="success"
+ className="no-toggle"
+ id="dropdown-comment">
+ <Icon name="three-dots" className="text-secondary" />
+ </Dropdown.Toggle>
+
+ <Dropdown.Menu align="end">
+ {memberActions.map((action) => {
+ return (
+ <Dropdown.Item
+ key={action.name}
+ variant="link"
+ size="sm"
+ onClick={() => onAction(action)}>
+ {action.name}
+ </Dropdown.Item>
+ );
+ })}
+ </Dropdown.Menu>
+ </Dropdown>
</div>
);
};
diff --git a/ui/src/components/Comment/components/Form/index.tsx b/ui/src/components/Comment/components/Form/index.tsx
index 7c7d9ebc..014dea46 100644
--- a/ui/src/components/Comment/components/Form/index.tsx
+++ b/ui/src/components/Comment/components/Form/index.tsx
@@ -31,7 +31,11 @@ const Form = ({
};
return (
- <div className={classNames('d-flex align-items-start', className)}>
+ <div
+ className={classNames(
+ 'd-flex align-items-start flex-column flex-md-row',
+ className,
+ )}>
<div>
<Mentions pageUsers={pageUsers.getUsers()}>
<TextArea size="sm" value={value} onChange={handleChange} />
@@ -39,17 +43,17 @@ const Form = ({
<div className="form-text">{t(`tip_${mode}`)}</div>
</div>
{type === 'edit' ? (
- <div className="d-flex flex-column">
+ <div className="d-flex flex-row flex-md-column ms-0 ms-md-2 mt-2 mt-md-0">
<Button
size="sm"
- className="text-nowrap ms-2"
+ className="text-nowrap "
onClick={() => onSendReply(value)}>
{t('btn_save_edits')}
</Button>
<Button
variant="link"
size="sm"
- className="text-nowrap ms-2 btn-no-border"
+ className="text-nowrap btn-no-border"
onClick={onCancel}>
{t('btn_cancel')}
</Button>
@@ -57,7 +61,7 @@ const Form = ({
) : (
<Button
size="sm"
- className="text-nowrap ms-2"
+ className="text-nowrap ms-0 ms-md-2 mt-2 mt-md-0"
onClick={() => onSendReply(value)}>
{t('btn_add_comment')}
</Button>
diff --git a/ui/src/components/Comment/components/Reply/index.tsx b/ui/src/components/Comment/components/Reply/index.tsx
index 551fa8e6..50d3bfc4 100644
--- a/ui/src/components/Comment/components/Reply/index.tsx
+++ b/ui/src/components/Comment/components/Reply/index.tsx
@@ -17,24 +17,24 @@ const Form = ({ userName, onSendReply, onCancel, mode }) => {
return (
<div className="mb-2">
<div className="fs-14 mb-2">Reply to {userName}</div>
- <div className="d-flex mb-1 align-items-start">
+ <div className="d-flex mb-1 align-items-start flex-column flex-md-row">
<div>
<Mentions pageUsers={pageUsers.getUsers()}>
<TextArea size="sm" value={value} onChange={handleChange} />
</Mentions>
<div className="form-text">{t(`tip_${mode}`)}</div>
</div>
- <div className="d-flex flex-column">
+ <div className="d-flex flex-row flex-md-column ms-0 ms-md-2 mt-2 mt-md-0">
<Button
size="sm"
- className="text-nowrap ms-2"
+ className="text-nowrap"
onClick={() => onSendReply(value)}>
{t('btn_add_comment')}
</Button>
<Button
variant="link"
size="sm"
- className="text-nowrap ms-2 btn-no-border"
+ className="text-nowrap btn-no-border"
onClick={onCancel}>
{t('btn_cancel')}
</Button>
diff --git a/ui/src/components/Comment/index.scss b/ui/src/components/Comment/index.scss
index 3decaffd..04dd1b3e 100644
--- a/ui/src/components/Comment/index.scss
+++ b/ui/src/components/Comment/index.scss
@@ -1,8 +1,14 @@
+@import 'bootstrap/scss/functions';
+@import 'bootstrap/scss/variables';
+@import 'bootstrap/scss/mixins/_breakpoints';
+
.comments-wrap {
.comment-item {
&:hover {
- .control-area {
- display: flex !important;
+ @include media-breakpoint-up(md) {
+ .control-area {
+ display: flex !important;
+ }
}
}
}