+
);
@@ -100,13 +33,13 @@ const renderContent = (data: MessagePayload) => {
const image = isImage(content_type, size);
// console.log("replying data", content_type, size, image);
if (image) {
- res =

;
+ res =

;
} else {
- const icon = getFileIcon(content_type, name);
+ const icon = getFileIcon(content_type, name, "icon w-4 h-5");
res = (
<>
{icon}
-
{name}
+
{name}
>
);
}
@@ -118,7 +51,6 @@ const renderContent = (data: MessagePayload) => {
// console.log("replying data", data);
return res;
};
-
export default function Replying({
context,
id,
@@ -138,15 +70,16 @@ export default function Replying({
if (!msg) return null;
const { from_uid = 0 } = msg;
const user = usersData[from_uid];
+
return (
-
-
- Replying to
{user?.name}
+
+
+ Replying to {user?.name}
-
{renderContent(msg)}
-
);
}
diff --git a/src/common/component/Send/index.tsx b/src/common/component/Send/index.tsx
index e18058ef..8eff2245 100644
--- a/src/common/component/Send/index.tsx
+++ b/src/common/component/Send/index.tsx
@@ -1,10 +1,12 @@
import { useEffect, useState, FC } from "react";
+import clsx from "clsx";
+import { useTranslation } from "react-i18next";
import useSendMessage from "../../hook/useSendMessage";
import useAddLocalFileMessage from "../../hook/useAddLocalFileMessage";
import { updateInputMode } from "../../../app/slices/ui";
import { ContentTypes, ChatPrefixes } from "../../../app/config";
-import StyledSend from "./styled";
+// import StyledSend from "./styled";
import UploadFileList from "./UploadFileList";
import Replying from "./Replying";
import Toolbar from "./Toolbar";
@@ -15,7 +17,6 @@ import MixedInput, { useMixedEditor } from "../MixedInput";
import useDraft from "../../hook/useDraft";
import useUploadFile from "../../hook/useUploadFile";
import { useAppDispatch, useAppSelector } from "../../../app/store";
-import { useTranslation } from "react-i18next";
const Modes = {
text: "text",
@@ -135,15 +136,16 @@ const Send: FC
= ({
const placeholder = `${t("send_to")} ${ChatPrefixes[context]}${name} `;
const members =
context == "channel" ? (channelsData[id]?.is_public ? uids : channelsData[id]?.members) : [];
+ const isMarkdownMode = mode == Modes.markdown;
return (
-
{replying_mid && }
{mode == Modes.text && }
-
+
{mode == Modes.text && (
= ({
/>
)}
-
+
);
};
diff --git a/src/common/component/Send/styled.tsx b/src/common/component/Send/styled.tsx
deleted file mode 100644
index d45fe1b5..00000000
--- a/src/common/component/Send/styled.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-import styled from "styled-components";
-
-const StyledSend = styled.div`
- position: relative;
- background: #e5e7eb;
- border-radius: var(--br);
- width: 100%;
- width: -webkit-fill-available;
- &.markdown.fullscreen {
- margin-top: -35px;
- }
- .send_box {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- gap: 15px;
- padding: 14px 18px;
- &.markdown {
- display: grid;
- grid-template-columns: 1fr 1fr;
- grid-template-rows: auto auto;
- gap: 0;
- .input {
- grid-column: span 2;
- }
- }
- &.reply {
- border-top-left-radius: 0;
- border-top-right-radius: 0;
- }
- .input {
- width: 100%;
- }
- }
-`;
-
-export default StyledSend;
diff --git a/src/common/component/styled/Button.tsx b/src/common/component/styled/Button.tsx
index a06787dd..eb6bc47a 100644
--- a/src/common/component/styled/Button.tsx
+++ b/src/common/component/styled/Button.tsx
@@ -1,63 +1,26 @@
-import styled from "styled-components";
-
-const StyledButton = styled.button`
- cursor: pointer;
- padding: 10px 14px;
- border: none;
- box-sizing: border-box;
- box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
- border-radius: var(--br, 4px);
- font-weight: 500;
- font-size: 14px;
- line-height: 20px;
- color: #fff;
- background-color: #22ccee;
- word-break: keep-all;
- &.flex {
- width: 100%;
- }
- &:hover,
- &:active {
- background-color: #06aed4;
- }
- &:focus {
- background-color: #22ccee;
- }
- &:disabled {
- background-color: #d0d5dd;
- }
- &.small {
- padding: 8px 14px;
- font-size: 14px;
- line-height: 20px;
- }
- &.mini {
- padding: 4px 10px;
- font-size: 12px;
- line-height: 18px;
- }
- &.danger {
- border: none;
- background-color: #ef4444;
- color: #fff;
- &:disabled {
- background-color: #fecdca;
- }
- }
- &.ghost {
- border: 1px solid #1fe1f9;
- background: none;
- color: #1fe1f9;
- }
- &.border_less {
- box-shadow: none;
- border: none !important;
- }
- &.cancel {
- border: 1px solid #e5e7eb;
- background: none;
- color: #374151;
- }
-`;
+import clsx from "clsx";
+import { ButtonHTMLAttributes, ReactNode } from "react";
+type Props = ButtonHTMLAttributes & { children?: ReactNode }
+const StyledButton = ({ children, className = '', ...rest }: Props) => {
+ const isGhost = className.includes('ghost');
+ const noBorder = className.includes('border_less');
+ const isCancel = className.includes('cancel');
+ const isDanger = className.includes('danger');
+ const isSmall = className.includes('small');
+ const isMini = className.includes('mini');
+ const isFull = className.includes('flex');
+ return
+ {children}
+ ;
+};
export default StyledButton;
diff --git a/src/common/component/styled/Menu.tsx b/src/common/component/styled/Menu.tsx
deleted file mode 100644
index 284a6f14..00000000
--- a/src/common/component/styled/Menu.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import styled from "styled-components";
-
-const StyledMenu = styled.ul`
- display: flex;
- flex-direction: column;
- gap: 2px;
- padding: 4px;
- background-color: #fff;
- box-shadow: 0 20px 25px 20px rgba(31, 41, 55, 0.1), 0 10px 10px rgba(31, 41, 55, 0.04);
- border-radius: 12px;
- min-width: 200px;
- .item {
- position: relative;
- display: flex;
- align-items: center;
- gap: 14px;
- white-space: nowrap;
- cursor: pointer;
- border-radius: 6px;
- padding: 6px;
- font-style: normal;
- font-weight: 600;
- font-size: 14px;
- line-height: 20px;
- color: #616161;
- .icon {
- width: 20px;
- height: 20px;
- path {
- fill: #475467;
- }
- }
- &.sb {
- justify-content: space-between;
- }
- &:hover {
- background-color: #22ccee;
- color: #fff;
- .icon {
- path {
- fill: #fff;
- }
- }
- }
- &.bottom_line {
- margin-bottom: 9px;
- &:before {
- position: absolute;
- content: "";
- left: 6px;
- bottom: -4px;
- display: block;
- padding: 0 6px;
- box-sizing: border-box;
- width: calc(100% - 12px);
- height: 1px;
- background-color: #f2f4f7;
- }
- }
- &.danger {
- color: #a11043;
- &:hover {
- background-color: #b42318;
- color: #fff;
- }
- }
- &[data-disabled="true"] {
- color: #a4a8b3;
- .icon {
- path {
- fill: #a4a8b3;
- }
- }
- }
- }
-`;
-
-export default StyledMenu;
diff --git a/src/common/component/styled/Radio.tsx b/src/common/component/styled/Radio.tsx
index 23486853..dc60df21 100644
--- a/src/common/component/styled/Radio.tsx
+++ b/src/common/component/styled/Radio.tsx
@@ -1,67 +1,5 @@
import { useState, useId, FC } from "react";
-import styled from "styled-components";
-const StyledForm = styled.form`
- width: 100%;
- > .option {
- &:not(:last-child) {
- margin-bottom: 8px;
- }
-
- > input[type="radio"] {
- display: none;
-
- & + .box {
- background: #ffffff;
- border: 1px solid #d0d5dd;
- box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
- border-radius: 8px;
- transition: all ease-in-out 250ms;
-
- & > label {
- display: flex;
- flex-direction: row;
- align-items: center;
- font-weight: 400;
- font-size: 16px;
- line-height: 24px;
- color: #667085;
- cursor: pointer;
- user-select: none;
- transition: all ease-in-out 250ms;
-
- &:before {
- content: "";
- display: inline-block;
- width: 14px;
- height: 14px;
- border-radius: 8px;
- background: #ffffff;
- box-shadow: inset 0 0 0 4px #ffffff;
- border: 1px solid #d0d5dd;
- margin: 14px 8px 14px 14px;
- transition: all ease-in-out 500ms;
- }
- }
- }
-
- &:checked + .box {
- background: #22ccee;
- border: 1px solid #d0d5dd;
-
- & > label {
- color: #ffffff;
-
- &:before {
- background: #ffffff;
- box-shadow: inset 0 0 0 4px #22ccee;
- border: 1px solid #ffffff;
- }
- }
- }
- }
- }
-`;
type Props = {
options: string[];
values: (string | number)[];
@@ -84,12 +22,12 @@ const Radio: FC = ({
const [fallbackValue, setFallbackValue] = useState(defaultValue);
const _value = value !== VALUE_NOT_SET ? value : fallbackValue;
-
return (
-
+