Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge/develop #97

Merged
merged 4 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/pricing/CollaCard/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

.cardContainerStyle {
@apply w-full rounded-[16px] overflow-hidden relative p-[24px] flex flex-col gap-[40px];
@apply w-full rounded-[16px] overflow-hidden relative p-[24px] flex flex-col gap-[40px] border-[2px] border-white/[0.08];
@apply lg:w-[600px];
background: radial-gradient(
98.85% 129.62% at 6.76% 2.06%,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,29 @@ const MobileCompare = ({ compare }) => {
return (
<div className={style.mobileCompareContainer}>
<div className={style.mobileTableHeader}>
{compare.tableHeader.map(({ label, mobileLabel }) => (
<div key={label} className={clsx(style.mobileTableHeaderItem)}>
{compare.tableHeader.map(({ label, mobileLabel }, i) => (
<div
key={`${label}${i}`}
className={clsx(style.mobileTableHeaderItem)}
>
{mobileLabel ?? label}
</div>
))}
</div>
<div className="w-full flex flex-col items-center gap-[20px]">
{compare.items.map(({ title, isTitle, texts, isColla }, index) =>
isTitle ? (
<span className={style.mobileTableTitleStyle}>{title}</span>
<span
className={style.mobileTableTitleStyle}
key={`${title}${index}`}
>
{title}
</span>
) : (
<div key={index} className={style.mobileTableContentContainer}>
<div
key={`${title}${index}`}
className={style.mobileTableContentContainer}
>
<p className={style.mobileTableItemLabelTitle}>{title}</p>
<div className="flex flex-row w-full">
{texts.map((text, index) => (
Expand All @@ -26,6 +37,7 @@ const MobileCompare = ({ compare }) => {
style.mobileTableItemSelect,
index !== 0 && "border-l",
)}
key={`${text}${index}`}
>
{(typeof text === "boolean" ||
(isColla && index !== 0)) && (
Expand Down
4 changes: 3 additions & 1 deletion src/components/pricing/PricingCompare/Compare/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const Compare = ({ compare, colNum = 3 }) => {
style.tableSticky,
i !== noBorder ? "border-r" : "",
)}
key={`${label}${link}${i}`}
>
<h2 className="font-[500] text-[22px] leading-[28px] text-center px-[16px]">
{label}
Expand All @@ -48,7 +49,7 @@ const Compare = ({ compare, colNum = 3 }) => {
</div>
))}
{compare.items.map(({ isTitle, title, texts }, index) => (
<Fragment key={index}>
<Fragment key={`${title}${index}`}>
<div
className={clsx(
isTitle ? style.titleTableContent : style.tableContent,
Expand All @@ -70,6 +71,7 @@ const Compare = ({ compare, colNum = 3 }) => {
style.tableSelect,
i !== noBorder ? "border-r" : "",
)}
key={`${val}${i}`}
>
{typeof val === "boolean" ? (
val && (
Expand Down
31 changes: 22 additions & 9 deletions src/components/pricing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,36 @@ const Tooltip: FC<TooltipProps> = ({ content, styles, isBound }) => {
gap = 5,
width = 200
const { top, left, visibility } = styles
const [currentVisibility, setCurrentVisibility] = useState(visibility)

const offsetHeight = ref.current?.offsetHeight
const currentStyle = {
top: isBound
? `${top + 24 + gap}px`
: `${top - offsetHeight / 2 + iconWidth * 2 - gap}px`,
left: isBound
? `${left - width / 1.5 + iconWidth}px`
: `${left + iconWidth * 2 + gap * 2}px`,
}
const currentStyle = useMemo(
() => ({
top: isBound
? `${top + 24 + gap}px`
: `${top - offsetHeight / 2 + iconWidth * 2 - gap}px`,
left: isBound
? `${left - width / 1.5 + iconWidth}px`
: `${left + iconWidth * 2 + gap * 2}px`,
}),
[isBound, left, offsetHeight, top],
)
// Get the size of the element for the first time but not display it, then update the position of the element and display it
useEffect(() => {
setCurrentVisibility(visibility)
}, [visibility])

return (
<div
className={clsx(
isBound ? style.bottomTip : style.rightTip,
style.tooltip,
)}
ref={ref}
style={{ visibility: visibility ? "visible" : "hidden", ...currentStyle }}
style={{
...currentStyle,
visibility: currentVisibility ? "visible" : "hidden",
}}
>
<p className={style.tipContent}>{content}</p>
</div>
Expand Down
1 change: 0 additions & 1 deletion static/img/pricing/collaCardBg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading