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

style(tags): redesign using hash svg #153

Merged
merged 4 commits into from
Oct 22, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const SideInfo: FC<TProps> = ({ article }) => {

<Label>发布时间</Label>
<Value>
<ReadableDate date={insertedAt} fmt="absolute" withTime={false} />
<ReadableDate date={insertedAt} withTime={false} />
</Value>
</InnerWrapper>
</Wrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const Count = styled.span`
`
export const Value = styled.div`
font-size: 13px;
color: ${theme('article.title')};
color: ${theme('article.digest')};
margin-bottom: 5px;
`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { FC, memo } from 'react'

import type { TCommunity } from '@/spec'
import { ICON } from '@/config'
import { buildLog } from '@/logger'

Expand All @@ -15,11 +14,7 @@ import { Wrapper, Item, Icon, Title } from '../styles/subscribed_list/item_menu'
/* eslint-disable-next-line */
const log = buildLog('C:CommunityContent')

type TProps = {
community: TCommunity
}

const ItemMenu: FC<TProps> = ({ community }) => {
const ItemMenu: FC = () => {
return (
<Wrapper>
<Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const SubscribedList: FC<TProps> = ({ community, communities }) => {
</Title>
<SpaceGrow />
<Tooltip
content={<ItemMenu community={community} />}
content={<ItemMenu />}
placement="bottom"
hideOnClick={false}
trigger="click"
Expand Down
7 changes: 2 additions & 5 deletions src/containers/digest/ArticleDigest/MobileView/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { FC, memo } from 'react'
import type { TArticle, TMetric } from '@/spec'

import METRIC from '@/constant/metric'
import type { TArticle } from '@/spec'

import PostLayout from './PostLayout'

type TProps = {
article: TArticle
metric?: TMetric
}

const Layout: FC<TProps> = ({ article, metric = METRIC.ARTICLE }) => {
const Layout: FC<TProps> = ({ article }) => {
return <PostLayout article={article} />
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const PostLayout: FC<TProps> = ({ metric = METRIC.ARTICLE, article }) => {
</div>
<Divider />
<PublishDateInfo>
<ReadableDate date={insertedAt} fmt="absolute" withTime={false} />
<ReadableDate date={insertedAt} withTime={false} />
</PublishDateInfo>
</Topping>
<Title>{title}</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/digest/ArticleDigest/MobileView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ArticleDigestContainer: FC<TProps> = ({
<InnerWrapper>
<Header metric={metric} />
<BannerContent>
<Layout article={viewingArticle} metric={metric} />
<Layout article={viewingArticle} />
</BannerContent>
</InnerWrapper>
<ViewportTracker onEnter={inAnchor} onLeave={outAnchor} />
Expand Down
4 changes: 0 additions & 4 deletions src/containers/digest/ArticleDigest/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ export const loadCommunity = (): void => {
sr71$.query(S.community, { slug })
}

export const handleWorksUpvote = (viewerHasUpvoted: boolean): void => {
//
}

// ###############################
// Data & Error handlers
// ###############################
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import styled from 'styled-components'
import Link from 'next/link'

import type { TMetric } from '@/spec'
import css, { theme } from '@/css'

import Img from '@/Img'
Expand Down
5 changes: 1 addition & 4 deletions src/containers/editor/ArticleEditor/AddOn/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { FC, memo } from 'react'

import type { TArticleThread } from '@/spec'

import type { TEditData } from '../spec'

import PostAddOn from './PostAddOn'

type TProps = {
thread: TArticleThread
editData: TEditData
}

const Addon: FC<TProps> = ({ thread, editData }) => {
const Addon: FC<TProps> = ({ editData }) => {
return <PostAddOn editData={editData} />
}

Expand Down
8 changes: 1 addition & 7 deletions src/containers/editor/ArticleEditor/PublishRules/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { FC, memo } from 'react'

import type { TArticleThread } from '@/spec'

import PostRules from './PostRules'

type TProps = {
thread: TArticleThread
}

const PublishRules: FC<TProps> = ({ thread }) => {
const PublishRules: FC = () => {
return <PostRules />
}

Expand Down
24 changes: 3 additions & 21 deletions src/containers/editor/ArticleEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,16 @@ const ArticleEditorContainer: FC<TProps> = ({
useInit(store)
const { activeCat, activeTagData } = store

const {
isArchived,
archivedAt,
mode,
submitState,
groupedTags,
texts,
editData,
viewingArticle,
allowEdit,
} = store

const { meta } = viewingArticle
const { isArchived, archivedAt, mode, submitState, groupedTags, texts, editData, allowEdit } =
store

const { title, body } = editData

const initEditor = mode === 'publish' || body !== '{}'

return (
<Wrapper testid={testid}>
<InnerWrapper metric={metric}>
{/* {communityData.id && (
<CommunityTagSetter
selectedCommunity={communityData}
onCommunitySelect={changeCommunity}
onTagSelect={onTagSelect}
/>
)} */}

<ContentWrapper>
{!allowEdit && <NoticeBar type="notice" content="只有作者可以编辑本内容。" left={25} />}
{isArchived && <ArchiveAlert date={archivedAt} top={12} bottom={20} left={25} />}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/editor/ArticleEditor/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const changeCommunity = (community: TCommunity): void => {
store.mark({ community })
}

export const onTagSelect = (tags: TTag[], checked: boolean): void => {
export const onTagSelect = (tags: TTag[]): void => {
store.mark({ articleTags: tags })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const DemoCommunity: FC<TProps> = ({ item }) => {
return (
<Wrapper>
<Community>
<Logo src={item.logo} slug={item.slug} />
<Logo src={item.logo} />
<Title href={`/${item.slug}`}>{item.title}</Title>
</Community>
</Wrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Content: FC<TProps> = ({ title = '', desc = '', logo, communityType, onHov
{communityType && (
<ThreadWrapper>
{communityIntros[communityType].threads.map((thread) => (
<ThreadItem key={thread} onMouseOver={(e) => onHoverThread(thread)}>
<ThreadItem key={thread} onMouseOver={() => onHoverThread(thread)}>
{Trans(thread)}
</ThreadItem>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/editor/CommunityEditor/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const DataSolver = [
{
match: asyncRes('hasPendingCommunityApply'),
action: ({ hasPendingCommunityApply }) => {
// store.mark({ hasPendingApply: hasPendingCommunityApply.exist })
store.mark({ hasPendingApply: hasPendingCommunityApply.exist })
},
},
{
Expand Down
3 changes: 0 additions & 3 deletions src/containers/editor/CoverEditor/Toolbox/ActionBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { FC, useState } from 'react'

import Tooltip from '@/widgets/Tooltip'

import type { TImageRadio } from '../spec'
import { IMAGE_RATIO } from '../constant'

import {
Wrapper,
Block,
Expand Down
9 changes: 1 addition & 8 deletions src/containers/editor/CoverEditor/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ import { useEffect } from 'react'
import type { TWallpaperGradientDir } from '@/spec'
import { buildLog } from '@/logger'

import type {
TImagePos,
TImageRadio,
TImageRotate,
TImageSize,
TLinearBorderPos,
TSettingLevel,
} from './spec'
import type { TImagePos, TImageRadio, TImageSize, TLinearBorderPos, TSettingLevel } from './spec'
import { IMAGE_POS } from './constant'
import type { TStore } from './store'

Expand Down
2 changes: 0 additions & 2 deletions src/containers/editor/RichEditor/RealEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type TProps = {
placeholder?: string
data?: string
type?: 'article' | 'works' | 'job' | 'comment' | 'radar'
addon?: ReactNode
reinitKey?: string
onChange?: (json) => void
}
Expand All @@ -39,7 +38,6 @@ const RichEditorContainer: FC<TProps> = ({
type = 'article',
reinitKey = '',
onChange = log,
addon = <div />,
}) => {
useInit(store)

Expand Down
2 changes: 0 additions & 2 deletions src/containers/editor/RichEditor/logic.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { useEffect } from 'react'

// import ERR from '@/constant/err'
import EVENT from '@/constant/event'
import TYPE from '@/constant/type'
import { buildLog } from '@/logger'
import type { TStore } from './store'

Expand Down
2 changes: 1 addition & 1 deletion src/containers/editor/RichEditor/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { T, Instance, markStates } from '@/mobx'

const RichEditor = T.model('RichEditor', {})
.views((self) => ({}))
.views(() => ({}))
.actions((self) => ({
mark(sobj: Record<string, unknown>): void {
markStates(sobj, self)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, memo } from 'react'
import { FC } from 'react'
import { observer } from 'mobx-react'

import type { TWallpaperGradientDir } from '@/spec'
Expand Down
2 changes: 1 addition & 1 deletion src/containers/layout/GlobalLayout/Addon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, Fragment, useEffect } from 'react'
import { observer } from 'mobx-react'
// import useMobileDetect from '@groupher/use-mobile-detect-hook'
// eslint-disable-next-line import/no-unresolved
import { Toaster } from 'sonner'

import useShortcut from '@/hooks/useShortcut'
Expand Down
2 changes: 1 addition & 1 deletion src/containers/thread/ArticlesThread/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getPagedArticlesSchema = (thread) => {
`
}

const getArticleFreshSchema = (thread) => {
const getArticleFreshSchema = () => {
// TODO: commentParticipants
return gql`
query post($id: ID!, $userHasLogin: Boolean!) {
Expand Down
6 changes: 1 addition & 5 deletions src/containers/thread/ChangelogThread/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ import { useInit } from './logic' /* eslint-disable-next-line */

type TProps = {
changelogThread?: TStore
testid?: string
}

const ChangelogThreadContainer: FC<TProps> = ({
changelogThread: store,
testid = 'changelog-thread',
}) => {
const ChangelogThreadContainer: FC<TProps> = ({ changelogThread: store }) => {
useInit(store)
const { globalLayout, tagsMode, pagedChangelogsData } = store

Expand Down
5 changes: 1 addition & 4 deletions src/containers/thread/DashboardThread/BasicInfo/BaseInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { FC, memo } from 'react'

import type { TPostLayout } from '@/spec'

import { Br } from '@/widgets/Common'
import OSSUploader from '@/widgets/OSSUploader'

Expand All @@ -24,12 +22,11 @@ import {
import { edit } from '../logic'

type TProps = {
testid?: TPostLayout
settings: TBaseInfoSettings
touched: TTouched
}

const BasicInfo: FC<TProps> = ({ testid = 'basic-info', settings, touched }) => {
const BasicInfo: FC<TProps> = ({ settings, touched }) => {
const { saving, desc, title, introduction, logo } = settings

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { FC, memo } from 'react'

import type { TPostLayout } from '@/spec'

import CitySelector from '@/widgets/CitySelector'
import { Br, SexyDivider } from '@/widgets/Common'

Expand All @@ -15,12 +13,11 @@ import { Wrapper, Label, Inputer, Desc } from '../../styles/basic_info/other_inf
import { edit } from '../../logic'

type TProps = {
testid?: TPostLayout
settings: TBaseInfoSettings
touched: TTouched
}

const OtherInfo: FC<TProps> = ({ testid = 'basic-info', settings, touched }) => {
const OtherInfo: FC<TProps> = ({ settings, touched }) => {
const { city, techstack } = settings

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { FC, memo } from 'react'

import type { TPostLayout } from '@/spec'

import SocialEditor from '@/widgets/SocialEditor'

import { SETTING_FIELD } from '../constant'
Expand All @@ -13,12 +11,11 @@ import { Wrapper } from '../styles/basic_info/base_info'
import { updateSocialLinks } from '../logic'

type TProps = {
testid?: TPostLayout
settings: TBaseInfoSettings
touched: TTouched
}

const SocialInfo: FC<TProps> = ({ testid = 'basic-info', settings, touched }) => {
const SocialInfo: FC<TProps> = ({ settings, touched }) => {
const { socialLinks, saving } = settings

return (
Expand Down
4 changes: 1 addition & 3 deletions src/containers/thread/DashboardThread/BasicInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { FC, useEffect } from 'react'
import { observer } from 'mobx-react'
import Router from 'next/router'

import type { TPostLayout } from '@/spec'
import { DASHBOARD_BASEINFO_ROUTE } from '@/constant/route'
import VIEW from '@/constant/view'

Expand All @@ -22,12 +21,11 @@ import { Wrapper, Banner, TabsWrapper } from '../styles/basic_info'
import { edit, loadBaseInfo } from '../logic'

type TProps = {
testid?: TPostLayout
settings: TBaseInfoSettings
touched: TTouched
}

const BasicInfo: FC<TProps> = ({ testid = 'basic-info', settings, touched }) => {
const BasicInfo: FC<TProps> = ({ settings, touched }) => {
const curCommunity = useViewingCommunity()
const { baseInfoTab } = settings

Expand Down
Loading
Loading