Skip to content

Commit

Permalink
Revert "Revert "Revert "Jason/refinement new arch"""
Browse files Browse the repository at this point in the history
This reverts commit 991bb42.
  • Loading branch information
duidae committed Jan 4, 2023
1 parent 9b5f28c commit 94f13a2
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const _ = {

const shiftLeftCss = css`
position: relative;
/* 20px is border-(right|left) width of article page */
/* 20px is border-(right|left) width of articlePage */
width: calc(100% + 20px);
left: -10px;
`
Expand Down Expand Up @@ -111,8 +111,8 @@ const DesktopAsideBlock = styled.div`

const MetadataAndToolsBlock = styled.div`
${mq.mobileOnly`
padding-top: 33px;
padding-bottom: 33px;
padding-top: 40px;
padding-bottom: 60px;
`}
${mq.tabletOnly`
Expand Down Expand Up @@ -192,7 +192,7 @@ const BackgroundBlock = styled(BorderBox)`
}
}
/* border-(right|left) of article page */
/* boreder-(right|left) of articlePage */
padding-left: 10px;
padding-right: 10px;
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ const MetadataContainer = styled.div`
letter-spacing: 0.4px;
${mq.mobileOnly`
padding-left: 24px;
padding-right: 24px;
width: calc(300/355*100%);
margin: 0 auto;
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ const largeWidthCSS = css`

const normalWidthCSS = css`
${mq.mobileOnly`
padding-left: 34px;
padding-right: 34px;
width: calc(300/375*100%);
`}
${mq.tabletOnly`
width: 453px;
Expand Down
14 changes: 2 additions & 12 deletions packages/react-article-components/src/components/leading/normal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ const TextBlock = styled.div`
margin: 0 auto;
${mq.mobileOnly`
padding-left: 24px;
padding-right: 24px;
width: calc(327/375*100%);
`}
${mq.tabletOnly`
Expand All @@ -50,7 +49,6 @@ const Title = styled.h1`
${mq.mobileOnly`
font-size: 34px;
margin-bottom: 38px;
`}
${mq.tabletAndAbove`
Expand Down Expand Up @@ -111,16 +109,8 @@ const FigCaption = styled.figcaption`

const BackgroundBlock = styled.div`
${props => getBackgroundBlockStyles(props.theme.name)}
${mq.hdOnly`
padding-top: 100px;
`}
${mq.desktopOnly`
padding-top: 48px;
`}
padding-top: 30px;
${mq.tabletOnly`
padding-top: 32px;
`}
${mq.mobileOnly`
padding-top: 30px;
`}
`
Expand Down
12 changes: 4 additions & 8 deletions packages/react-components/src/bookmark-list/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const PageContainer = styled.div`
const Column = styled.div`
margin: 0 auto;
width: 97%;
max-width: 922px;
max-width: 834px;
${mq.tabletOnly`
width: 100%;
max-width: 698px;
max-width: 707px;
`}
${mq.mobileOnly`
width: 100%;
Expand All @@ -49,12 +49,8 @@ const Column = styled.div`

const StatusBar = styled.div`
${mq.mobileOnly`
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
`}
${mq.tabletOnly`
padding-bottom: 32px;
padding-left: 1em;
padding-right: 1em;
`}
padding-bottom: 64px;
width: stretch;
Expand Down
35 changes: 24 additions & 11 deletions packages/react-components/src/listing-page/components/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import styled from 'styled-components'
import entityPaths from '@twreporter/core/lib/constants/entity-path'
import mq from '@twreporter/core/lib/utils/media-query'
import { date2yyyymmdd } from '@twreporter/core/lib/utils/date'
import { fontWeight } from '@twreporter/core/lib/constants/font'
// constants
import mockup from '../constants/mockup-spec'
import color from '../constants/color'
// components
import ListItem from './list-item'
import PageContent from './page-content'
import { TitleBar } from '../../title-bar'
import FetchingWrapper from '../../is-fetching-wrapper'
// lodash
import forEach from 'lodash/forEach'
Expand All @@ -23,9 +23,26 @@ const _ = {
map,
}

const Container = styled.div`
margin: 45px auto 0 auto;
`

const Header = styled.div`
font-size: 36px;
font-weight: ${fontWeight.bold};
color: ${color.darkDarkGray};
margin: 0 auto 45px auto;
text-align: center;
${mq.mobileOnly`
width: ${(mockup.mobile.cardWidth / mockup.mobile.maxWidth) * 100}%;
text-align: left;
`}
`

const FlexItems = styled.div`
width: ${mockup.hd.maxWidth}px;
margin: 64px auto 0;
margin: 0 auto;
display: flex;
justify-content: flex-start;
align-items: flex-start;
Expand All @@ -41,12 +58,10 @@ const FlexItems = styled.div`
${mq.tabletOnly`
width: ${mockup.tablet.maxWidth}px;
margin-top: 32px;
`}
${mq.mobileOnly`
width: 100%;
margin-top: 24px;
> div:nth-child(odd) {
margin-right: 0;
}
Expand Down Expand Up @@ -106,17 +121,15 @@ class List extends PureComponent {
/>
)
})
const headerTitle = catName || tagName
const headerJSX = headerTitle ? (
<TitleBar title={headerTitle ?? ''} />
) : null
const headerTitle = catName || (tagName ? `#${tagName}` : '')
const headerJSX = headerTitle ? <Header>{headerTitle}</Header> : null
return (
<PageContent>
<Container>
{headerJSX}
<Items isFetching={isFetching} showSpinner={showSpinner}>
{listJSX}
</Items>
</PageContent>
</Container>
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import FetchingWrapper from '../../../is-fetching-wrapper'
import PostsContainer from './posts'
import PostItem from './post-item'
import TopicItem from './topic-item'
import PageContent from '../page-content'
import { TopSectionContent, ListSectionContent } from './section'
import PageContent from './page-content'
import { TopSectionContent, ListSectionContent, SectionTitle } from './section'
// constants
import { TEXT } from '../../constants/topics'
import color from '../../constants/color'
// @twreporter
import { fontWeight } from '@twreporter/core/lib/constants/font'
import { TitleBar } from '@twreporter/react-components/lib/title-bar'
// lodash
import get from 'lodash/get'
import map from 'lodash/map'
Expand All @@ -31,8 +30,6 @@ const NoData = styled.div`
text-align: center;
`

const topicTitleText = '深度專題'

class Topics extends Component {
_buildRelatedPosts(posts) {
const _buildPostJSX = post => {
Expand Down Expand Up @@ -100,11 +97,9 @@ class Topics extends Component {
topTopicName = _.get(topics, [0, 'topic_name'], '')
topicUrl = _.get(topics, [0, 'linkTo'], '')
topSectionJSX = [
<TitleBar
key="top-title"
title={topicTitleText}
subtitle={TEXT.SECTION_TITLE_FEATURED}
/>,
<SectionTitle key="top-title">
{TEXT.SECTION_TITLE_FEATURED}
</SectionTitle>,
<TopSectionContent
key="top-section"
topicName={topTopicName}
Expand All @@ -128,10 +123,7 @@ class Topics extends Component {
<PageContent>
{topSectionJSX}
{isFetching && isFirstPage ? null : (
<TitleBar
title={topicTitleText}
subtitle={TEXT.SECTION_TITLE_OTHERS}
/>
<SectionTitle>{TEXT.SECTION_TITLE_OTHERS}</SectionTitle>
)}
<WrappedListSectionContent
isFetching={isFetching}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import styled from 'styled-components'
import { resetLinkStyle } from '../constants/predefined-css'
import { resetLinkStyle } from '../../constants/predefined-css'
import mq from '@twreporter/core/lib/utils/media-query'

const styles = {
contentWidth: {
min: 300, // px
mobile: 95, // %
tablet: 698, // px
desktop: 922, // px
tablet: 700, // px
desktop: 870, // px
},
titlePadding: 0,
titleMargin: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ const styles = {
goToTopicMargin: [20, 'auto', 0, 'auto'],
goToTopicPadding: [14, 0, 14, 0],
sectionMargin: {
mobile: [24, 0, 36, 0],
tablet: [32, 0, 64, 0],
desktop: [64, 0, 64, 0],
mobile: [0, 0, 35, 0],
tablet: [0, 0, 42, 0],
desktop: [0, 0, 60, 0],
},
titleMargin: {
mobile: [0, 0, 24, 0],
tablet: [0, 0, 32, 0],
desktop: [0, 0, 64, 0],
tablet: [0, 0, 42, 0],
},
titlePadding: [16, 0, 16, 0],
}
Expand All @@ -34,11 +33,22 @@ const StyledLink = styled(Link)`
margin: ${arrayToCssShorthand(styles.goToTopicMargin)};
`

const SectionContent = styled.div`
const SectionTitle = styled.div`
width: 100%;
${mq.mobileOnly`
margin: ${arrayToCssShorthand(styles.sectionMargin.mobile)};
border-bottom: 2px solid ${color.gray};
padding: ${arrayToCssShorthand(styles.titlePadding)};
color: ${color.darkGray};
font-size: 18px;
font-weight: ${fontWeight.bold};
line-height: 1;
margin: ${arrayToCssShorthand(styles.titleMargin.mobile)};
${mq.tabletAndAbove`
margin: ${arrayToCssShorthand(styles.titleMargin.tablet)};
`}
`
const SectionContent = styled.div`
width: 100%;
margin: ${arrayToCssShorthand(styles.sectionMargin.mobile)};
${mq.tabletOnly`
margin: ${arrayToCssShorthand(styles.sectionMargin.tablet)};
`}
Expand Down Expand Up @@ -104,4 +114,4 @@ ListSectionContent.propTypes = {
children: PropTypes.node.isRequired,
}

export { TopSectionContent, ListSectionContent }
export { TopSectionContent, ListSectionContent, SectionTitle }

0 comments on commit 94f13a2

Please sign in to comment.