From 6883e5ddb001c429becf198acc4e596554bbcd37 Mon Sep 17 00:00:00 2001 From: monoid Date: Mon, 25 Jan 2021 21:44:44 +0900 Subject: [PATCH] add MangaTagDetail --- src/client/component/contentinfo.tsx | 40 +++++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/client/component/contentinfo.tsx b/src/client/component/contentinfo.tsx index a88c61f..12a45c9 100644 --- a/src/client/component/contentinfo.tsx +++ b/src/client/component/contentinfo.tsx @@ -41,6 +41,7 @@ const useStyles = makeStyles((theme: Theme) => ({ display: 'grid', gridTemplateColumns: '100px auto', overflowY: 'hidden', + alignItems: 'baseline', }, short_subinfoContainer:{ [theme.breakpoints.down("md")]:{ @@ -96,9 +97,6 @@ export const ContentInfo = (props: { classes.thumbnail_content; const subinfoContainer = props.short ? classes.short_subinfoContainer : classes.subinfoContainer; - let allTag = document.tags; - const artists = allTag.filter(x => x.startsWith("artist:")).map(x => x.slice(7)); - allTag = allTag.filter(x => !x.startsWith("artist:")); return ( {document.tags.map(x => () )}) : ( - <> - Artist - {artists.join(", ")} - Tags - - {allTag.map(x => { - return (); - })} - - ) + ) } ); +} + +function MangaDetailTag(prop:{tags:string[],classes:{ + tag_list:string +}}){ + let allTag = prop.tags; + const tagKind = ["artist","group","series","type","character"]; + let tagTable:{[kind:string]:string[]} = {}; + for(const kind of tagKind){ + const tags = allTag.filter(x => x.startsWith(kind+":")).map(x => x.slice(kind.length+1)); + tagTable[kind] = tags; + allTag = allTag.filter(x => !x.startsWith(kind+":")); + } + return ( + {tagKind.map(key=>( + + {key} + {tagTable[key].length !== 0 ? tagTable[key].join(", ") : "N/A"} + + ))} + Tags + + {allTag.map(x => ())} + + ); } \ No newline at end of file