Skip to content

Commit

Permalink
chore: update tooltip text for contact button (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnsonMao authored Jul 25, 2024
1 parent d8134bc commit 28321c6
Showing 1 changed file with 39 additions and 14 deletions.
53 changes: 39 additions & 14 deletions components/Group/detail/Contact/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useId, useState, forwardRef, useEffect } from 'react';
import { useRouter } from 'next/router';
import { useSelector } from 'react-redux';
import Link from 'next/link';
import styled from '@emotion/styled';
import {
Avatar,
Expand All @@ -23,6 +24,19 @@ import Feedback from './Feedback';

const ROLELIST = mapToTable(ROLE);

const StyledButton = styled(Button)`
padding: 8px 36px;
line-height: 1.5;
border-radius: 20px;
color: #ffff;
background-color: #16b9b3;
font-size: 16px;
&:disabled img {
mix-blend-mode: difference;
opacity: 0.3;
}
`;
const StyledTitle = styled.label`
display: block;
color: var(--black-white-gray-dark, #293a3d);
Expand All @@ -41,6 +55,18 @@ const StyledTextArea = styled(TextareaAutosize)`
width: 100%;
min-height: 128px;
`;
const StyledLink = styled(Link)`
margin-top: 6px;
margin-left: 6px;
display: block;
color: black;
font-size: 12px;
`;
const StyledSpan = styled.span`
padding: 0 2px;
color: #16b9b3;
text-decoration: underline;
`;

const Transition = forwardRef((props, ref) => {
return <Slide direction="up" ref={ref} {...props} />;
Expand All @@ -66,6 +92,7 @@ function ContactButton({
const descriptionId = `modal-description-${id}`;
const messageId = `message-${id}`;
const contactId = `contact-${id}`;
const isLogin = !!me?._id;
const role =
ROLE.find(({ key }) => user?.roleList?.includes(key))?.label || '暫無資料';

Expand Down Expand Up @@ -108,21 +135,13 @@ function ContactButton({

useEffect(() => {
if (!me?._id && open) router.push('/login');
}, [me, open, router]);
}, [me?._id, open, router]);

return (
<>
<Button
<div>
<StyledButton
variant="contained"
sx={{
p: '8px 36px',
lineHeight: 1.5,
borderRadius: '20px',
color: '#ffff',
bgcolor: '#16B9B3',
fontSize: '16px',
}}
disabled={isLoading}
disabled={!isLogin || isLoading}
onClick={() => setOpen(true)}
>
<img
Expand All @@ -131,7 +150,13 @@ function ContactButton({
style={{ marginRight: '8px' }}
/>
{label}
</Button>
</StyledButton>
{!isLogin && (
<StyledLink href="/login">
<StyledSpan>註冊</StyledSpan><StyledSpan>登入</StyledSpan>
即可聯繫主揪!
</StyledLink>
)}
<Dialog
keepMounted
scroll="body"
Expand Down Expand Up @@ -285,7 +310,7 @@ function ContactButton({
</Box>
</Dialog>
<Feedback type={feedback} onClose={() => setFeedback('')} />
</>
</div>
);
}

Expand Down

0 comments on commit 28321c6

Please sign in to comment.