shortening info tag
This commit is contained in:
parent
dfc154b711
commit
29beb1dc80
@ -43,9 +43,9 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
overflowY: 'hidden',
|
||||
},
|
||||
short_subinfoContainer:{
|
||||
[theme.breakpoints.up("xs")]:{
|
||||
[theme.breakpoints.down("md")]:{
|
||||
display:'none',
|
||||
}
|
||||
},
|
||||
},
|
||||
short_root:{
|
||||
overflowY:'hidden',
|
||||
@ -103,8 +103,10 @@ export const ContentInfo = (props: {
|
||||
<Link className={propclasses.thumbnail_anchor || thumbnail_anchor} component={RouterLink} to={{
|
||||
pathname:makeContentReaderUrl(document.id)
|
||||
}}>
|
||||
<ThumbnailContainer content={document}
|
||||
className={propclasses.thumbnail_content || thumbnail_content}/>
|
||||
{document.deleted_at === null ?
|
||||
(<ThumbnailContainer content={document}
|
||||
className={propclasses.thumbnail_content || thumbnail_content}/>)
|
||||
: (<Typography className={propclasses.thumbnail_content || thumbnail_content} variant='h4'>Deleted</Typography>)}
|
||||
</Link>
|
||||
<Box className={propclasses.infoContainer || classes.infoContainer}>
|
||||
<Link variant='h5' color='inherit' component={RouterLink} to={{
|
||||
@ -114,6 +116,10 @@ export const ContentInfo = (props: {
|
||||
{document.title}
|
||||
</Link>
|
||||
<Box className={propclasses.subinfoContainer || subinfoContainer}>
|
||||
{props.short ? (<Box className={propclasses.tag_list || classes.tag_list}>{document.tags.map(x =>
|
||||
(<TagChip key={x} label={x} clickable={true} tagname={x} size="small"></TagChip>)
|
||||
)}</Box>) : (
|
||||
<>
|
||||
<Typography variant='subtitle1'>Artist</Typography>
|
||||
<Box style={{ alignSelf: "center" }}>{artists.join(", ")}</Box>
|
||||
<Typography variant='subtitle1'>Tags</Typography>
|
||||
@ -122,6 +128,8 @@ export const ContentInfo = (props: {
|
||||
return (<TagChip key={x} label={x} clickable={true} tagname={x} size="small"></TagChip>);
|
||||
})}
|
||||
</Box>
|
||||
</>)
|
||||
}
|
||||
</Box>
|
||||
</Box>
|
||||
</Paper>);
|
||||
|
@ -59,6 +59,15 @@ export const ColorChip = (props:Omit<ChipProps,"color"> & {color: string})=>{
|
||||
}
|
||||
|
||||
export const TagChip = (props:Omit<ChipProps,"color"> & {tagname: string})=>{
|
||||
const {tagname,...rest} = props;
|
||||
return <ColorChip color={getTagColorName(tagname)} {...rest}></ColorChip>;
|
||||
const {tagname,label,...rest} = props;
|
||||
let newlabel:string|undefined = undefined;
|
||||
if(typeof label === "string"){
|
||||
if(label.startsWith("female:")){
|
||||
newlabel ="♀ "+label.substr(7);
|
||||
}
|
||||
else if(label.startsWith("male:")){
|
||||
newlabel = "♂ "+label.substr(5);
|
||||
}
|
||||
}
|
||||
return <ColorChip color={getTagColorName(tagname)} label={newlabel||label} {...rest}></ColorChip>;
|
||||
}
|
Loading…
Reference in New Issue
Block a user