diff --git a/src/client/component/galleryinfo.tsx b/src/client/component/galleryinfo.tsx deleted file mode 100644 index a65f155..0000000 --- a/src/client/component/galleryinfo.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { Box, Paper, Link, useMediaQuery, Portal, List, ListItem, ListItemIcon, Tooltip, ListItemText } from '@material-ui/core'; -import {useTheme, makeStyles, Theme} from '@material-ui/core/styles'; -import React, { useEffect, useState } from 'react'; -import ContentAccessor,{QueryListOption, Document} from '../accessor/document'; -import {Link as RouterLink} from 'react-router-dom'; -import { LoadingCircle, ContentInfo, NavList, NavItem } from './mod'; -import {toQueryString} from '../accessor/util'; - -const useStyles = makeStyles((theme:Theme)=>({ - root:{ - display:"grid", - gridGap: theme.spacing(4), - }, -})); - -export type GalleryProp = { - option?:QueryListOption; -}; -type GalleryState = { - documents:Document[]|undefined; -} - -export const GalleryInfo = (props: GalleryProp)=>{ - const [state,setState]= useState({documents:undefined}); - useEffect(()=>{ - const load = (async ()=>{ - console.log("mounted"); - const c = await ContentAccessor.findList(props.option); - //todo : if c is undefined, retry to fetch 3 times. and show error message. - setState({documents:c}); - }) - load(); - },[props.option]); - const classes = useStyles(); - const queryString = toQueryString(props.option||{}); - - if(state.documents === undefined){ - return (); - } - else{ - return ({ - state.documents.map(x=>{ - return (); - }) - } - ); - } -} \ No newline at end of file diff --git a/src/client/component/mod.ts b/src/client/component/mod.ts index 71885dd..ba044dd 100644 --- a/src/client/component/mod.ts +++ b/src/client/component/mod.ts @@ -2,5 +2,4 @@ export * from './contentinfo'; export * from './loading'; export * from './tagchip'; export * from './navlist'; -export * from './galleryinfo'; export * from './headline'; \ No newline at end of file diff --git a/src/client/page/gallery.tsx b/src/client/page/gallery.tsx index 74d710f..a531a4b 100644 --- a/src/client/page/gallery.tsx +++ b/src/client/page/gallery.tsx @@ -1,9 +1,56 @@ -import React, { useContext, useEffect } from 'react'; -import { Headline, CommonMenuList } from '../component/mod'; -import {GalleryInfo} from '../component/mod'; +import React, { useContext, useEffect, useState } from 'react'; +import { Headline, CommonMenuList,LoadingCircle, ContentInfo, NavList, NavItem } from '../component/mod'; + +import { Box, Paper, Link, useMediaQuery, Portal, List, ListItem, ListItemIcon, Tooltip, ListItemText } from '@material-ui/core'; +import {useTheme, makeStyles, Theme} from '@material-ui/core/styles'; +import ContentAccessor,{QueryListOption, Document} from '../accessor/document'; +import {Link as RouterLink} from 'react-router-dom'; +import {toQueryString} from '../accessor/util'; + import {useLocation} from 'react-router-dom'; import { QueryStringToMap } from '../accessor/util'; +const useStyles = makeStyles((theme:Theme)=>({ + root:{ + display:"grid", + gridGap: theme.spacing(4), + }, +})); + +export type GalleryProp = { + option?:QueryListOption; + diff:string; +}; +type GalleryState = { + documents:Document[]|undefined; +} + +export const GalleryInfo = (props: GalleryProp)=>{ + const [state,setState]= useState({documents:undefined}); + useEffect(()=>{ + const load = (async ()=>{ + const c = await ContentAccessor.findList(props.option); + //todo : if c is undefined, retry to fetch 3 times. and show error message. + setState({documents:c}); + }) + load(); + },[props.diff]); + const classes = useStyles(); + const queryString = toQueryString(props.option||{}); + + if(state.documents === undefined){ + return (); + } + else{ + return ({ + state.documents.map(x=>{ + return (); + }) + } + ); + } +} export const Gallery = ()=>{ const location = useLocation(); @@ -11,6 +58,6 @@ export const Gallery = ()=>{ const menu_list = CommonMenuList({url:location.search}); return ( - + ) } \ No newline at end of file