forked from czy0729/Bangumi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
330 additions
and
152 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
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,78 @@ | ||
/* | ||
* @Author: czy0729 | ||
* @Date: 2023-07-06 07:36:09 | ||
* @Last Modified by: czy0729 | ||
* @Last Modified time: 2023-07-06 07:45:32 | ||
*/ | ||
import React from 'react' | ||
import { View } from 'react-native' | ||
import { observer } from 'mobx-react' | ||
import { _, systemStore } from '@stores' | ||
import { HTMLDecode } from '@utils' | ||
import { Touchable } from '../../../touchable' | ||
import { Flex } from '../../../flex' | ||
import { Text } from '../../../text' | ||
import { Iconfont } from '../../../iconfont' | ||
import { Cover } from '../../../cover' | ||
import Rank from '../rank' | ||
import { memoStyles } from '../styles' | ||
|
||
function Subject({ | ||
text, | ||
href, | ||
image, | ||
name, | ||
name_cn, | ||
rating, | ||
rank, | ||
air_date, | ||
onLinkPress | ||
}) { | ||
const styles = memoStyles() | ||
const top = HTMLDecode(name_cn || name || text || '') | ||
const bottom = HTMLDecode( | ||
text !== top && text !== href ? text : name || name_cn || '' | ||
) | ||
const showScore = !systemStore.setting.hideScore && !!rating?.score | ||
const showBottom = bottom && bottom !== top | ||
return ( | ||
<View style={styles.wrap}> | ||
<Touchable animate onPress={onLinkPress}> | ||
<Flex style={styles.body}> | ||
<Cover src={image} size={40} radius={_.radiusXs} /> | ||
<View style={_.ml.sm}> | ||
<Text style={styles.top} size={12} bold numberOfLines={2} selectable> | ||
{top} | ||
{!!air_date && air_date !== '0000-00-00' && ( | ||
<Text size={10} lineHeight={12} type='sub' bold> | ||
{' '} | ||
{String(air_date).slice(0, 7)} | ||
</Text> | ||
)} | ||
</Text> | ||
{(showScore || showBottom) && ( | ||
<Flex style={_.mt.sm}> | ||
{showScore && ( | ||
<Flex style={_.mr.xs}> | ||
<Rank value={rank} /> | ||
<Iconfont name='md-star' size={10} color={_.colorWarning} /> | ||
<Text style={_.ml.xxs} type='sub' size={10} bold> | ||
{rating?.score} | ||
</Text> | ||
{!!rating?.total && ( | ||
<Text style={_.ml.xs} type='sub' size={10} bold> | ||
({rating?.total}) | ||
</Text> | ||
)} | ||
</Flex> | ||
)} | ||
</Flex> | ||
)} | ||
</View> | ||
</Flex> | ||
</Touchable> | ||
</View> | ||
) | ||
} | ||
|
||
export default observer(Subject) |
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.