-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #557 from urfit-tech/feat/SecondaryProgramPage-dat…
…a-setup feat/SecondaryProgramPage-data-setup
- Loading branch information
Showing
15 changed files
with
1,151 additions
and
1,072 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import React from 'react' | ||
import { defineMessages, useIntl } from 'react-intl' | ||
import styled from 'styled-components' | ||
const StyledTag = styled.p` | ||
const StyledTag = styled.p<{ color?: string }>` | ||
padding: 2px 6px; | ||
font-size: 12px; | ||
letter-spacing: 0.6px; | ||
color: ${props => props.theme['@primary-color']}; | ||
border: 1px solid ${props => props.theme['@primary-color']}; | ||
color: ${props => (!!props.color ? props.color : props.theme['@primary-color'])}; | ||
border: 1px solid ${props => (!!props.color ? props.color : props.theme['@primary-color'])}; | ||
border-radius: 4px; | ||
` | ||
const messages = defineMessages({ | ||
hasGiftPlan: { id: 'common.label.hasGiftPlan', defaultMessage: '附贈品' }, | ||
}) | ||
|
||
const GiftPlanTag: React.VFC = () => { | ||
const GiftPlanTag: React.VFC<{ color?: string }> = ({ color }) => { | ||
const { formatMessage } = useIntl() | ||
return <StyledTag>{formatMessage(messages.hasGiftPlan)}</StyledTag> | ||
return <StyledTag color={color}>{formatMessage(messages.hasGiftPlan)}</StyledTag> | ||
} | ||
|
||
export default GiftPlanTag |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
68 changes: 68 additions & 0 deletions
68
src/pages/ProgramPage/Secondary/SecondaryInstructorCollectionBlock/CollapseContentBlock.tsx
This file contains 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,68 @@ | ||
import { Box } from '@chakra-ui/react' | ||
import styled from 'styled-components' | ||
import { usePostPreviewCollection } from '../../../../hooks/blog' | ||
import { usePodcastProgramCollection } from '../../../../hooks/podcast' | ||
import { usePublishedProgramCollection } from '../../../../hooks/program' | ||
import EmptyCover from '../../../../images/empty-cover.png' | ||
import CollapseContent from './CollapseContent' | ||
import CollapseContentCard from './CollapseContentCard' | ||
|
||
const StyledCollapseContentWrapper = styled(Box)` | ||
display: grid; | ||
grid-row-gap: 12px; | ||
margin-top: 24px; | ||
grid-template-columns: 1fr; | ||
place-items: center; | ||
padding-bottom: 24px; | ||
` | ||
|
||
const CollapseContentBlock: React.FC<{ creatorId: string }> = ({ creatorId }) => { | ||
const { programs } = usePublishedProgramCollection({ | ||
instructorId: creatorId, | ||
isPrivate: false, | ||
}) | ||
|
||
const { podcastPrograms } = usePodcastProgramCollection(creatorId) | ||
const { posts } = usePostPreviewCollection({ authorId: creatorId }) | ||
return ( | ||
<> | ||
<CollapseContent title={`開設課程(${programs.length})`}> | ||
<StyledCollapseContentWrapper> | ||
{programs.map(program => ( | ||
<CollapseContentCard | ||
imgSrc={program.coverThumbnailUrl || program.coverUrl || program.coverMobileUrl || EmptyCover} | ||
href={`/program/${program.id}`} | ||
key={program.id} | ||
> | ||
{program.title} | ||
</CollapseContentCard> | ||
))} | ||
</StyledCollapseContentWrapper> | ||
</CollapseContent> | ||
<CollapseContent title={`廣播頻道(${podcastPrograms.length})`}> | ||
<StyledCollapseContentWrapper> | ||
{podcastPrograms.map(podcast => ( | ||
<CollapseContentCard | ||
imgSrc={podcast.coverUrl || EmptyCover} | ||
href={`/podcast/${podcast.id}`} | ||
key={podcast.id} | ||
> | ||
{podcast.title} | ||
</CollapseContentCard> | ||
))} | ||
</StyledCollapseContentWrapper> | ||
</CollapseContent> | ||
<CollapseContent title={`媒體文章(${posts.length})`}> | ||
<StyledCollapseContentWrapper> | ||
{posts.map(post => ( | ||
<CollapseContentCard imgSrc={post.coverUrl || EmptyCover} href={`/posts/${post.id}`} key={post.id}> | ||
{post.title} | ||
</CollapseContentCard> | ||
))} | ||
</StyledCollapseContentWrapper> | ||
</CollapseContent> | ||
</> | ||
) | ||
} | ||
|
||
export default CollapseContentBlock |
This file contains 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.