|
1 | 1 | import { useData } from "vike-react/useData"; |
2 | | -import { LexItemPage } from "~/components/lex"; |
| 2 | +import h from "./main.module.sass"; |
| 3 | +import { LexItemPage, ConceptInfo, Charts } from "~/components/lex"; |
| 4 | +import { StratTag } from "~/components/general"; |
| 5 | +import { LinkCard } from "~/components/cards"; |
3 | 6 |
|
4 | 7 | export function Page() { |
5 | | - const { resData, colData, taxaData, refs } = useData(); |
| 8 | + const { resData, refs } = useData(); |
| 9 | + |
| 10 | + const id = resData.concept_id; |
| 11 | + |
| 12 | + const { name } = resData; |
| 13 | + |
| 14 | + const children = [ |
| 15 | + h(ConceptInfo, { concept_id: id, showHeader: false }), |
| 16 | + h(ConceptBody, { resData }), |
| 17 | + ]; |
6 | 18 |
|
7 | 19 | return LexItemPage({ |
8 | | - id: resData.concept_id, |
9 | | - header: "strat_name_concepts", |
10 | | - resData, |
11 | | - colData, |
12 | | - taxaData, |
| 20 | + children, |
| 21 | + id, |
13 | 22 | refs, |
| 23 | + resData, |
| 24 | + siftLink: "strat_name_concept", |
| 25 | + header: h("div.concept-header", [ |
| 26 | + h("h1.concept-title", name), |
| 27 | + h(StratTag, { isConcept: true, fontSize: "1.6em" }), |
| 28 | + ]), |
14 | 29 | }); |
15 | 30 | } |
| 31 | + |
| 32 | +function ConceptBody({ resData }) { |
| 33 | + let { strat_names, strat_ids, strat_ranks } = resData; |
| 34 | + |
| 35 | + const stratNames = strat_names ? strat_names.split(",") : []; |
| 36 | + const stratIds = strat_ids ? strat_ids.split(",") : []; |
| 37 | + const stratRanks = strat_ranks ? strat_ranks.split(",") : []; |
| 38 | + const strats = stratNames.map((name, i) => ({ |
| 39 | + name, |
| 40 | + id: stratIds[i], |
| 41 | + rank: stratRanks[i], |
| 42 | + })); |
| 43 | + |
| 44 | + return h("div.concept-body", [ |
| 45 | + h("h2.strat-names", "Strat Names"), |
| 46 | + h( |
| 47 | + "ul.strat-name-list", |
| 48 | + strats.map((strat) => |
| 49 | + h( |
| 50 | + LinkCard, |
| 51 | + { href: "/lex/strat-names/" + strat.id, className: "strat-name" }, |
| 52 | + strat.name + " (" + strat.rank + ")" |
| 53 | + ) |
| 54 | + ) |
| 55 | + ), |
| 56 | + ]); |
| 57 | +} |
0 commit comments