This repository was archived by the owner on Nov 8, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork37
feat(dashboard): add banner notify setting#1353
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
3 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
8 changes: 7 additions & 1 deletionsrc/containers/layout/GlobalLayout/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletionssrc/containers/layout/GlobalLayout/store.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
198 changes: 198 additions & 0 deletionssrc/containers/thread/DashboardThread/UI/BannerNotifyLayout.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
import { FC, memo } from 'react' | ||
import type { TBannerNotifyLayout, TColorName } from '@/spec' | ||
import { BANNER_NOTIFY_LAYOUT, DASHBOARD_DESC_LAYOUT } from '@/constant' | ||
import { callDashboardDesc } from '@/utils/helper' | ||
import { Br, Space, SpaceGrow, Inline } from '@/widgets/Common' | ||
import ColorSelector from '@/widgets/ColorSelector' | ||
import ArrowButton from '@/widgets/Buttons/ArrowButton' | ||
import CheckLabel from '@/widgets/CheckLabel' | ||
import { SETTING_FIELD } from '../constant' | ||
import SectionLabel from '../SectionLabel' | ||
import SavingBar from '../SavingBar' | ||
import { | ||
Wrapper, | ||
SelectWrapper, | ||
Layout, | ||
LayoutTitle, | ||
Block, | ||
Bar, | ||
NotifyBar, | ||
NotifyDesc, | ||
NotifyLink, | ||
NotifySolidLink, | ||
CrossIcon, | ||
ArrowIcon, | ||
Main, | ||
ListsWrapper, | ||
TagssWrapper, | ||
BgWrapper, | ||
BgLabel, | ||
TheColor, | ||
} from '../styles/ui/banner_notify_layout' | ||
import { edit } from '../logic' | ||
type TProps = { | ||
layout: TBannerNotifyLayout | ||
isLayoutTouched: boolean | ||
isBgTouched: boolean | ||
saving: boolean | ||
bg: TColorName | ||
} | ||
const BannerNotifyLayout: FC<TProps> = ({ | ||
layout, | ||
isLayoutTouched, | ||
isBgTouched, | ||
saving, | ||
bg, | ||
}) => { | ||
return ( | ||
<Wrapper> | ||
<SectionLabel | ||
title="横幅通知" | ||
desc={ | ||
<> | ||
全局横幅通知的样式,当用户设置内容时会以一下样式展示。 | ||
<Inline> | ||
<ArrowButton | ||
onClick={() => | ||
callDashboardDesc(DASHBOARD_DESC_LAYOUT.POST_LIST) | ||
} | ||
size="tiny" | ||
arrowStyle="simple" | ||
> | ||
查看示例 | ||
</ArrowButton> | ||
</Inline> | ||
</> | ||
} | ||
/> | ||
<SelectWrapper> | ||
<Layout | ||
onClick={() => | ||
edit(BANNER_NOTIFY_LAYOUT.DEFAULT, 'bannerNotifyLayout') | ||
} | ||
> | ||
<Block $active={layout === BANNER_NOTIFY_LAYOUT.DEFAULT}> | ||
<NotifyBar bg={bg}> | ||
<NotifyDesc>这是一条全局通知,全站可见。</NotifyDesc> | ||
<SpaceGrow /> | ||
<NotifySolidLink bg={bg}>查看详情</NotifySolidLink> | ||
<Space left={5} /> | ||
<CrossIcon /> | ||
</NotifyBar> | ||
<Main> | ||
<ListsWrapper> | ||
<Bar long={60} thin /> | ||
<Br bottom={14} /> | ||
<Bar long={50} thin /> | ||
<Br bottom={14} /> | ||
<Bar long={55} thin /> | ||
<Br bottom={14} /> | ||
<Bar long={40} thin /> | ||
<Br bottom={14} /> | ||
</ListsWrapper> | ||
<TagssWrapper> | ||
<Br bottom={10} /> | ||
<Bar long={60} thin /> | ||
<Br bottom={6} /> | ||
<Bar long={85} thin /> | ||
<Br bottom={6} /> | ||
<Bar long={50} thin /> | ||
<Br bottom={6} /> | ||
</TagssWrapper> | ||
</Main> | ||
</Block> | ||
<LayoutTitle $active={layout === BANNER_NOTIFY_LAYOUT.DEFAULT}> | ||
<CheckLabel | ||
title="常规式" | ||
$active={layout === BANNER_NOTIFY_LAYOUT.DEFAULT} | ||
top={15} | ||
left={-15} | ||
/> | ||
</LayoutTitle> | ||
</Layout> | ||
<Space right={40} /> | ||
<Layout | ||
onClick={() => | ||
edit(BANNER_NOTIFY_LAYOUT.CENTER, 'bannerNotifyLayout') | ||
} | ||
> | ||
<Block $active={layout === BANNER_NOTIFY_LAYOUT.CENTER}> | ||
<NotifyBar bg={bg} center> | ||
<NotifyDesc>这是一条全局通知,全站可见。</NotifyDesc> | ||
<NotifyLink>查看详情</NotifyLink> | ||
<Space left={5} /> | ||
<ArrowIcon /> | ||
</NotifyBar> | ||
<Main> | ||
<ListsWrapper> | ||
<Bar long={60} thin /> | ||
<Br bottom={14} /> | ||
<Bar long={50} thin /> | ||
<Br bottom={14} /> | ||
<Bar long={55} thin /> | ||
<Br bottom={14} /> | ||
<Bar long={40} thin /> | ||
<Br bottom={14} /> | ||
</ListsWrapper> | ||
<TagssWrapper> | ||
<Br bottom={10} /> | ||
<Bar long={60} thin /> | ||
<Br bottom={6} /> | ||
<Bar long={85} thin /> | ||
<Br bottom={6} /> | ||
<Bar long={50} thin /> | ||
<Br bottom={6} /> | ||
</TagssWrapper> | ||
</Main> | ||
</Block> | ||
<LayoutTitle $active={layout === BANNER_NOTIFY_LAYOUT.CENTER}> | ||
<CheckLabel | ||
title="居中式" | ||
$active={layout === BANNER_NOTIFY_LAYOUT.CENTER} | ||
top={15} | ||
left={-15} | ||
/> | ||
</LayoutTitle> | ||
</Layout> | ||
</SelectWrapper> | ||
<SavingBar | ||
isTouched={isLayoutTouched} | ||
field={SETTING_FIELD.BANNER_NOTIFY_LAYOUT} | ||
loading={saving} | ||
top={20} | ||
/> | ||
<Br top={30} /> | ||
<SavingBar | ||
isTouched={isBgTouched} | ||
field={SETTING_FIELD.BANNER_NOTIFY_BG} | ||
loading={saving} | ||
> | ||
<BgWrapper> | ||
<div>背景色</div> | ||
<BgLabel bg={bg}> | ||
<ColorSelector | ||
activeColor={bg} | ||
onChange={(color) => edit(color, 'bannerNotifyBg')} | ||
placement="right" | ||
offset={[-1, 15]} | ||
> | ||
<TheColor color={bg} /> | ||
</ColorSelector> | ||
</BgLabel> | ||
</BgWrapper> | ||
</SavingBar> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(BannerNotifyLayout) |
11 changes: 11 additions & 0 deletionssrc/containers/thread/DashboardThread/UI/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletionssrc/containers/thread/DashboardThread/constant.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletionssrc/containers/thread/DashboardThread/spec.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletionssrc/containers/thread/DashboardThread/store.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.