You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2024/01/16 10:36:16 UTC

(incubator-answer) 01/01: fix: change invite answer componet styles

This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch feat/1.2.5/ui
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit f54715fe1d7125e2c7d424aa5b47bbeee5653f3b
Author: shuai <li...@sifou.com>
AuthorDate: Tue Jan 16 18:36:03 2024 +0800

    fix: change invite answer componet styles
---
 .../components/InviteToAnswer/PeopleDropdown.scss  | 22 +++------
 .../components/InviteToAnswer/PeopleDropdown.tsx   |  3 +-
 .../Detail/components/InviteToAnswer/index.tsx     | 52 +++++++++++-----------
 3 files changed, 34 insertions(+), 43 deletions(-)

diff --git a/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.scss b/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.scss
index 595fdebd..3767bce5 100644
--- a/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.scss
+++ b/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.scss
@@ -16,22 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
+.card-body {
+  box-sizing: border-box;
+}
 .people-dropdown {
-  border: var(--bs-border-width) solid var(--bs-border-color-translucent);
-  border-top: 0;
-  border-bottom-left-radius: var(--bs-border-radius);
-  border-bottom-right-radius: var(--bs-border-radius);
-  .dropdown-menu {
-    transform: translate(0, 0px) !important;
-    border: none;
-    border-top-left-radius: 0;
-    border-top-right-radius: 0;
-  }
-
-  .border-top {
-    border-top: var(--bs-border-width) solid var(--bs-border-color-translucent);
-  }
+  position: absolute;
+  top: 34px;
+  left: 0;
+  width: 100%;
 
   .dropdown-item.active {
     color: #212529;
diff --git a/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx b/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx
index 2ba3970b..cd21a73e 100644
--- a/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx
+++ b/ui/src/pages/Questions/Detail/components/InviteToAnswer/PeopleDropdown.tsx
@@ -144,7 +144,7 @@ const Index: FC<Props> = ({
       <Dropdown.Menu
         renderOnMount
         show
-        className="w-100 py-0 position-relative border-top-0">
+        className="w-100 py-0 position-relative">
         <div className="p-3">
           <Form.Control
             type="search"
@@ -164,6 +164,7 @@ const Index: FC<Props> = ({
                 <Form.Check
                   type="checkbox"
                   id={p.username}
+                  tabIndex={-1}
                   className="position-relative">
                   <Form.Check.Input
                     type="checkbox"
diff --git a/ui/src/pages/Questions/Detail/components/InviteToAnswer/index.tsx b/ui/src/pages/Questions/Detail/components/InviteToAnswer/index.tsx
index 494f90f2..be5cde3c 100644
--- a/ui/src/pages/Questions/Detail/components/InviteToAnswer/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/InviteToAnswer/index.tsx
@@ -109,7 +109,7 @@ const Index: FC<Props> = ({ questionId, readOnly = false }) => {
   }
 
   return (
-    <Card className="invite-answer-card border-0">
+    <Card className="invite-answer-card position-relative border-0">
       <Card.Header className="text-nowrap d-flex justify-content-between text-capitalize">
         {t('title')}
         {!readOnly && (
@@ -121,38 +121,36 @@ const Index: FC<Props> = ({ questionId, readOnly = false }) => {
           </Button>
         )}
       </Card.Header>
-      {editing ? (
+      <Card.Body className={classNames('position-relative')}>
+        <div className={classNames('d-flex align-items-center flex-wrap m-n1')}>
+          {users?.map((user) => {
+            return (
+              <Link
+                key={user.username}
+                to={`/users/${user.username}`}
+                className="mx-2 my-1 d-inline-flex flex-nowrap">
+                <Avatar
+                  avatar={user.avatar}
+                  size="24"
+                  alt={user.display_name}
+                  className="rounded-1"
+                />
+                <small className="ms-2">{user.display_name}</small>
+              </Link>
+            );
+          })}
+          {users?.length === 0 ? (
+            <div className="text-muted">{t('desc')}</div>
+          ) : null}
+        </div>
+      </Card.Body>
+      {editing && (
         <PeopleDropdown
           visible={editing}
           selectedPeople={users}
           onSelect={updateInviteUsers}
           saveInviteUsers={saveInviteUsers}
         />
-      ) : (
-        <Card.Body>
-          <div
-            className={classNames('d-flex align-items-center flex-wrap m-n1')}>
-            {users?.map((user) => {
-              return (
-                <Link
-                  key={user.username}
-                  to={`/users/${user.username}`}
-                  className="mx-2 my-1 d-inline-flex flex-nowrap">
-                  <Avatar
-                    avatar={user.avatar}
-                    size="24"
-                    alt={user.display_name}
-                    className="rounded-1"
-                  />
-                  <small className="ms-2">{user.display_name}</small>
-                </Link>
-              );
-            })}
-            {users?.length === 0 ? (
-              <div className="text-muted">{t('desc')}</div>
-            ) : null}
-          </div>
-        </Card.Body>
       )}
     </Card>
   );