Skip to content

Commit

Permalink
fix: sort items
Browse files Browse the repository at this point in the history
  • Loading branch information
ingun37 committed Oct 26, 2022
1 parent 849119e commit 5f20244
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/decoders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export const TreeTem = struct({
});

export type TreeTemT = TypeOf<typeof TreeTem>;
export type ItemT = TypeOf<typeof Item>;
52 changes: 27 additions & 25 deletions src/pages/recursive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,33 +91,35 @@ export default function Recursive(props: { sha1: string | TreeTemT }) {
</Card>
))}
</Stack>
{nonBooks.map((item) => (
<Accordion
TransitionProps={{ unmountOnExit: true }}
key={item.sha1}
>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel1a-content"
id="panel1a-header"
{nonBooks
.sort((x, y) => x.title.localeCompare(y.title))
.map((item) => (
<Accordion
TransitionProps={{ unmountOnExit: true }}
key={item.sha1}
>
<Typography sx={{ flex: 2 }}>{item.title}</Typography>
<IconButton
color="primary"
component="span"
onClick={(e) => {
dispatch(sha1Slice.actions.setSha1(item.sha1));
e.stopPropagation();
}}
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
aria-controls="panel1a-content"
id="panel1a-header"
>
<ShareIcon />
</IconButton>
</AccordionSummary>
<AccordionDetails>
<Recursive sha1={item.sha1} />
</AccordionDetails>
</Accordion>
))}
<Typography sx={{ flex: 2 }}>{item.title}</Typography>
<IconButton
color="primary"
component="span"
onClick={(e) => {
dispatch(sha1Slice.actions.setSha1(item.sha1));
e.stopPropagation();
}}
>
<ShareIcon />
</IconButton>
</AccordionSummary>
<AccordionDetails>
<Recursive sha1={item.sha1} />
</AccordionDetails>
</Accordion>
))}
</div>
);
}
Expand Down
20 changes: 20 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 16",

"compilerOptions": {
"lib": [
"es2021",
"dom"
],
"module": "commonjs",
"target": "es2021",

"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"jsx": "react"
}
}

0 comments on commit 5f20244

Please sign in to comment.