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
refactor(layout): HolyGrailLayout && re-org#1104
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
15 commits Select commitHold shift + click to select a range
733d548
chore: wip
mydearxym5c985b1
chore: re-org & convert to ts
mydearxym339f140
chore: wip
mydearxym810b467
chore: add template for PublishButton
mydearxym0cffeea
feat: add subed communities demo list
mydearxym15866c1
chore: improve subscribe list in holygrail view
mydearxym39fc554
chore: clean up
mydearxyme17371c
refactor(navigator): convert to TS
mydearxymb281230
chore: holy grail wip
mydearxym5a649fa
chore: layout switch wip
mydearxym5eb4a36
chore: layout switch wip
mydearxymd0168e8
chore: adjust footer padding for classic layout
mydearxym277ff29
chore(poststhread): move classicsidebar to own file
mydearxymd7b092c
refactor(layout): extract thread sidebar
mydearxymf55f0f7
refactor(layout): add missing LAPTOP_M_PADDING
mydearxymFile 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
1 change: 1 addition & 0 deletionspublic/icons/static/article/unpin.svg
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletionssrc/components/Buttons/FancyPublishButton.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,71 @@ | ||
/* | ||
* | ||
* PublishButton | ||
* | ||
*/ | ||
import { memo, FC } from 'react' | ||
import { ICON_CMD } from '@/config' | ||
import { buildLog } from '@/utils' | ||
import Tooltip from '@/components/Tooltip' | ||
import { | ||
Wrapper, | ||
Label, | ||
LabelIcon, | ||
ActionLink, | ||
Icon, | ||
} from './styles/fancy_publish_button' | ||
/* eslint-disable-next-line */ | ||
const log = buildLog('c:PublishButton:index') | ||
type TProps = { | ||
label?: string | ||
labelIconSrc?: string | ||
onPublish?: () => void | ||
onVote?: () => void | ||
onImport?: () => void | ||
onFAQ?: () => void | ||
} | ||
const PublishButton: FC<TProps> = ({ | ||
label = '发布帖子 ', | ||
labelIconSrc = `${ICON_CMD}/publish_pen.svg`, | ||
onPublish = log, | ||
onVote = log, | ||
onImport = log, | ||
onFAQ = log, | ||
}) => { | ||
return ( | ||
<Wrapper> | ||
<Label> | ||
<div>{label}</div> | ||
<LabelIcon src={labelIconSrc} /> | ||
</Label> | ||
<Tooltip content="发布帖子" placement="bottom" duration={0}> | ||
<ActionLink onClick={onPublish}> | ||
<Icon src={`${ICON_CMD}/publish_write.svg`} /> | ||
</ActionLink> | ||
</Tooltip> | ||
<Tooltip content="发布投票" placement="bottom" duration={0}> | ||
<ActionLink onClick={onVote}> | ||
<Icon src={`${ICON_CMD}/publish_vote.svg`} /> | ||
</ActionLink> | ||
</Tooltip> | ||
<Tooltip content="导入内容" placement="bottom" duration={0}> | ||
<ActionLink onClick={onImport}> | ||
<Icon src={`${ICON_CMD}/publish_import.svg`} /> | ||
</ActionLink> | ||
</Tooltip> | ||
<Tooltip content="发帖礼仪" placement="bottom" duration={0}> | ||
<ActionLink onClick={onFAQ}> | ||
<Icon src={`${ICON_CMD}/publish_faq.svg`} /> | ||
</ActionLink> | ||
</Tooltip> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(PublishButton) |
107 changes: 60 additions & 47 deletionssrc/components/Buttons/PublishButton.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
1 change: 1 addition & 0 deletionssrc/components/Buttons/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
116 changes: 116 additions & 0 deletionssrc/components/Buttons/styles/fancy_publish_button.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import styled from 'styled-components' | ||
import Img from '@/Img' | ||
import { css, theme } from '@/utils' | ||
// see example: https://codepen.io/mydearxym2/pen/qBEvvpo | ||
const commonHoverAffix = ` | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
${css.flex('align-center')}; | ||
height: 100%; | ||
transition: 0.25s linear; | ||
z-index: 1; | ||
` | ||
export const Wrapper = styled.div` | ||
position: relative; | ||
${css.flex('align-both')}; | ||
width: 100%; | ||
max-width: 300px; | ||
height: 32px; | ||
background-color: #3680ad; /* 消失的时候背景色 */ | ||
border-radius: 3px; | ||
/* | ||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); | ||
*/ | ||
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); | ||
overflow: hidden; | ||
&:hover { | ||
background-color: #22637e; /* #46627f; */ | ||
/* | ||
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); | ||
*/ | ||
} | ||
&:hover span { | ||
opacity: 0; | ||
z-index: -3; | ||
} | ||
&:hover:before { | ||
opacity: 0.5; | ||
transform: translateY(-100%); | ||
} | ||
&:hover:after { | ||
opacity: 0.5; | ||
transform: translateY(100%); | ||
} | ||
&:before { | ||
${commonHoverAffix}; | ||
width: 70%; | ||
left: 0; | ||
justify-content: flex-end; | ||
background-color: #3e8ebf; | ||
} | ||
&:after { | ||
${commonHoverAffix}; | ||
width: 30%; | ||
right: 0; | ||
justify-content: flex-start; | ||
background-color: #327faf; | ||
} | ||
` | ||
export const Label = styled.span` | ||
${css.flex('align-center', 'justify-between')}; | ||
padding-left: 16px; | ||
padding-right: 16px; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
color: ${theme('button.fg')}; | ||
font-family: 'Fira Mono', monospace; | ||
font-size: 14px; | ||
letter-spacing: 4px; | ||
opacity: 1; | ||
transition: opacity 0.25s; | ||
z-index: 2; | ||
` | ||
export const LabelIcon = styled(Img)` | ||
fill: ${theme('button.fg')}; | ||
${css.size(14)}; | ||
` | ||
export const ActionLink = styled.a` | ||
position: relative; | ||
${css.flex('align-both')}; | ||
/* width: 25%; */ | ||
width: 45px; | ||
/* height: 100%; */ | ||
height: 32px; | ||
color: whitesmoke; | ||
font-size: 24px; | ||
text-decoration: none; | ||
transition: 0.25s; | ||
&:hover { | ||
background: #18587a; | ||
} | ||
` | ||
export const Icon = styled(Img)` | ||
fill: ${theme('button.fg')}; | ||
${css.size(16)}; | ||
${ActionLink}:hover & { | ||
fill: ${theme('button.hoverBg')}; | ||
cursor: pointer; | ||
width: 18px; | ||
height: 18px; | ||
} | ||
transition: all 0.25s; | ||
` |
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.