Skip to content

Commit

Permalink
Merge pull request #3329 from thematters/hotfix/revise-few-ui-change-…
Browse files Browse the repository at this point in the history
…prod

[*master*] Hotfix/revise few UI change prod
  • Loading branch information
wlliaml authored Apr 7, 2023
2 parents 70d077a + 6c72e49 commit 39485de
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 65 deletions.
2 changes: 1 addition & 1 deletion src/common/enums/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ export const TEXT = {
enterUserNameAgain: 'Enter Matters ID again',
enterVerificationCode: 'Enter verification code',
ENTITY_NOT_FOUND: 'Entity not found',
expand: 'Expand',
expand: 'More',
extend: 'Collect',
collectArticle: 'Collect Article',
failureChange: 'Failed to edit, please try again.',
Expand Down
5 changes: 1 addition & 4 deletions src/components/Comment/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface ContentProps {
type: CommentFormType
size?: 'sm' | 'md-s'
bgColor?: 'grey-lighter' | 'white'
bgActiveColor?: 'grey-lighter' | 'white'
limit?: number
textIndent?: boolean
isRichShow?: boolean
Expand Down Expand Up @@ -50,8 +49,7 @@ const Content = ({
type,
size,
bgColor,
bgActiveColor,
limit = 8,
limit = 10,
textIndent = false,
isRichShow = true,
}: ContentProps) => {
Expand Down Expand Up @@ -90,7 +88,6 @@ const Content = ({
limit={limit}
isRichShow={isRichShow}
bgColor={bgColor}
bgActiveColor={bgActiveColor}
textIndent={textIndent}
>
<section
Expand Down
10 changes: 8 additions & 2 deletions src/components/Comment/Feed/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useLazyQuery } from '@apollo/react-hooks'
import React from 'react'

import { AvatarSize, CommentFormType, UserDigest } from '~/components'
import { AvatarSize, CommentFormType, Media, UserDigest } from '~/components'
import {
FeedCommentPrivateFragment,
FeedCommentPublicFragment,
Expand Down Expand Up @@ -83,7 +83,13 @@ export const BaseCommentFeed = ({
)}

<section className="content-container">
<Content comment={comment} type={type} size="md-s" />
<Media at="sm">
<Content comment={comment} type={type} size="md-s" limit={17} />
</Media>
<Media greaterThan="sm">
<Content comment={comment} type={type} size="md-s" limit={13} />
</Media>

<FooterActions
comment={comment}
type={type}
Expand Down
38 changes: 18 additions & 20 deletions src/components/Expandable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface ExpandableProps {
textIndent?: boolean
isRichShow?: boolean
bgColor?: 'grey-lighter' | 'white'
bgActiveColor?: 'grey-lighter' | 'white'
}

export const Expandable: React.FC<ExpandableProps> = ({
Expand All @@ -47,7 +46,6 @@ export const Expandable: React.FC<ExpandableProps> = ({
textIndent = false,
isRichShow = false,
bgColor = 'white',
bgActiveColor,
}) => {
const [expandable, setExpandable] = useState(false)
const [lineHeight, setLineHeight] = useState(24)
Expand All @@ -69,7 +67,11 @@ export const Expandable: React.FC<ExpandableProps> = ({
const richWrapperClasses = classNames({
richWrapper: true,
[`${bgColor}`]: !!bgColor,
[`${bgActiveColor}-active`]: !!bgActiveColor,
})

const richShowMoreButtonClasses = classNames({
richShowMoreButton: true,
[`${bgColor}`]: !!bgColor,
})

useEffect(() => {
Expand Down Expand Up @@ -101,7 +103,7 @@ export const Expandable: React.FC<ExpandableProps> = ({
<div ref={node}>
{(!expandable || (expandable && expand)) && <div>{children}</div>}
</div>
{expandable && expand && (
{expandable && expand && !isRichShow && (
<section className="collapseWrapper">
<Button
spacing={['xxtight', 'xtight']}
Expand All @@ -111,14 +113,14 @@ export const Expandable: React.FC<ExpandableProps> = ({
setExpand(!expand)
}}
>
<TextIcon icon={<IconArrowUp16 />}>
<TextIcon icon={<IconArrowUp16 />} textPlacement="left">
<Translate zh_hans="收起" zh_hant="收合" en="collapse" />
</TextIcon>
</Button>
</section>
)}
{expandable && !expand && (
<p>
<p className="unexpandWrapper">
{!isRichShow && (
<TextTruncate
line={limit}
Expand Down Expand Up @@ -162,20 +164,16 @@ export const Expandable: React.FC<ExpandableProps> = ({
>
{children}
</div>
<section className="collapseWrapper">
<Button
spacing={['xxtight', 'xtight']}
bgColor="grey-lighter"
textColor="grey"
onClick={() => {
setExpand(!expand)
}}
>
<TextIcon icon={<IconArrowDown16 />}>
<Translate id="expand" />
</TextIcon>
</Button>
</section>
<button
className={richShowMoreButtonClasses}
onClick={() => {
setExpand(!expand)
}}
>
<TextIcon icon={<IconArrowDown16 />}>
<Translate id="expand" />
</TextIcon>
</button>
</>
)}
</p>
Expand Down
45 changes: 36 additions & 9 deletions src/components/Expandable/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,49 @@
margin-top: var(--spacing-x-tight);
}

& .unexpandWrapper {
position: relative;

& .richShowMoreButton {
@mixin flex-start-center;

position: absolute;
bottom: 0;
align-items: flex-end;
width: 100%;
height: 7.5rem;
color: var(--color-grey);

&:hover {
color: var(--color-grey-darker);
}

&.white {
background: linear-gradient(
180deg,
rgb(255 255 255 / 0%) 0%,
var(--color-white) 100%
);
}

&.grey-lighter {
background: linear-gradient(
180deg,
rgb(247 247 247 / 0%) 0%,
var(--color-grey-lighter) 100%
);
}
}
}

& .richWrapper {
overflow-y: hidden;
overflow-y: clip;

&::after {
position: absolute;
right: 0;
bottom: 2rem;
bottom: 0;
left: 0;
height: 80%;
pointer-events: none;
Expand All @@ -42,14 +77,6 @@
var(--color-grey-lighter) 100%
);
}

&.grey-lighter-active::after {
background: linear-gradient(
180deg,
rgb(247 247 247 / 0%) 0%,
var(--color-grey-lighter-active) 100%
);
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/components/Hook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export * from './useDialogSwitch'
export * from './useERC20'
export * from './useEventListener'
export * from './useFeatures'
export * from './useHover'
export * from './useImmersiveMode'
export * from './useInterval'
export * from './useNativeEventListener'
Expand Down
23 changes: 0 additions & 23 deletions src/components/Hook/useHover.tsx

This file was deleted.

8 changes: 3 additions & 5 deletions src/components/Notice/NoticeComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import gql from 'graphql-tag'

import { TEST_ID } from '~/common/enums'
import { toPath } from '~/common/utils'
import { Card, useHover } from '~/components'
import { Card } from '~/components'
import CommentContent from '~/components/Comment/Content'
import { NoticeCommentFragment } from '~/gql/graphql'

Expand Down Expand Up @@ -51,8 +51,6 @@ const NoticeComment = ({
const circle =
comment?.node.__typename === 'Circle' ? comment.node : undefined

const [hoverRef, isHovered] = useHover<HTMLDivElement>()

if (!comment) {
return null
}
Expand All @@ -68,10 +66,11 @@ const NoticeComment = ({
: {}

return (
<section className="sub-content" ref={hoverRef}>
<section className="sub-content">
<Card
{...path}
bgColor="grey-lighter"
bgActiveColor="grey-lighter"
spacing={['xtight', 'base']}
borderRadius="xtight"
testId={TEST_ID.DIGEST_COMMENT_NOTICE}
Expand All @@ -81,7 +80,6 @@ const NoticeComment = ({
type="article"
size="sm"
bgColor="grey-lighter"
bgActiveColor={isHovered ? 'grey-lighter' : undefined}
/>
</Card>

Expand Down
1 change: 1 addition & 0 deletions src/views/ArticleDetail/SupportWidget/Donators/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const Donators = ({ article, showAvatarAnimation = false }: DonatorsProps) => {
<TextIcon
icon={<IconArrowRight16 size="xs" />}
textPlacement="left"
size="xs"
>
<Translate
zh_hant="個人支持過本文・查看全部"
Expand Down
1 change: 1 addition & 0 deletions src/views/User/Comments/UserComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ const BaseUserComments = ({ user }: UserIdUserQuery) => {
<List.Item key={comment.id}>
<Card
spacing={['tight', 'base']}
bgColor="none"
{...toPath({
page: 'commentDetail',
comment,
Expand Down

0 comments on commit 39485de

Please sign in to comment.