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

shuai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git

commit d2efdade1941a80b72be9b1f30e4b13e79ef26ed
Author: hgaol <dhan...@hotmail.com>
AuthorDate: Fri Apr 25 19:29:44 2025 +0800

    feat: implement dark mode support for reaction buttons and update styles 
accordingly
---
 ui/src/pages/Questions/Detail/components/Reactions/index.tsx | 10 ++++++----
 ui/src/pages/Questions/Detail/index.scss                     | 10 ++++++++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/ui/src/pages/Questions/Detail/components/Reactions/index.tsx 
b/ui/src/pages/Questions/Detail/components/Reactions/index.tsx
index 8fa09509..6405de3b 100644
--- a/ui/src/pages/Questions/Detail/components/Reactions/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/Reactions/index.tsx
@@ -26,6 +26,7 @@ import classNames from 'classnames';
 import { Icon } from '@/components';
 import { queryReactions, updateReaction } from '@/services';
 import { tryNormalLogged } from '@/utils/guard';
+import { isDarkTheme } from '@/utils/common';
 import { ReactionItem } from '@/common/interface';
 
 interface Props {
@@ -60,6 +61,7 @@ const Index: FC<Props> = ({
   const [reactions, setReactions] = useState<ReactionItem[]>();
   const [reactIsActive, setReactIsActive] = useState<boolean>(false);
   const { t } = useTranslation('translation');
+  const darkMode = isDarkTheme();
 
   useEffect(() => {
     queryReactions(objectId).then((res) => {
@@ -94,7 +96,7 @@ const Index: FC<Props> = ({
                 : t(`reaction.${d.name}`)
             }
             key={d.icon}
-            variant="light"
+            variant={darkMode ? 'dark' : 'light'}
             active={reactions?.find((v) => v.emoji === d.name)?.is_active}
             className={`${index !== 0 ? 'ms-1' : ''}`}
             size="sm"
@@ -116,7 +118,7 @@ const Index: FC<Props> = ({
       {showAddCommentBtn && (
         <Button
           className="rounded-pill me-2 link-secondary"
-          variant="light"
+          variant={darkMode ? 'dark' : 'light'}
           size="sm"
           onClick={handleClickComment}>
           <Icon name="chat-text-fill" />
@@ -136,7 +138,7 @@ const Index: FC<Props> = ({
           aria-haspopup="true"
           active={reactIsActive}
           className="smile-btn rounded-pill link-secondary"
-          variant="light">
+          variant={darkMode ? 'dark' : 'light'}>
           <Icon name="emoji-smile-fill" />
           <span className="ms-1">+</span>
         </Button>
@@ -165,7 +167,7 @@ const Index: FC<Props> = ({
                   : t('reaction.react_emoji', { emoji: data.emoji })
               }
               aria-pressed="true"
-              variant="light"
+              variant={darkMode ? 'dark' : 'light'}
               active={data.is_active}
               size="sm"
               onClick={() =>
diff --git a/ui/src/pages/Questions/Detail/index.scss 
b/ui/src/pages/Questions/Detail/index.scss
index 4b9eb622..8c7396ad 100644
--- a/ui/src/pages/Questions/Detail/index.scss
+++ b/ui/src/pages/Questions/Detail/index.scss
@@ -27,11 +27,17 @@
         [data-bs-theme='dark'] & {
           background-color: var(--bs-gray-800);
         }
+
         background-color: var(--bs-gray-100);
       }
 
-      &:active, &.active {
+      &:active,
+      &.active {
         background-color: var(--bs-gray-200);
+
+        [data-bs-theme='dark'] & {
+          background-color: var(--bs-gray-800);
+        }
       }
     }
   }
@@ -59,4 +65,4 @@
       font-size: calc(1.275rem + 0.3vw) !important;
     }
   }
-}
+}
\ No newline at end of file

Reply via email to