Skip to content

Commit 08cf9e1

Browse files
committed
fix styling
1 parent c2abd08 commit 08cf9e1

File tree

3 files changed

+53
-19
lines changed

3 files changed

+53
-19
lines changed

pages/lex/strat-name-concepts/+data.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { apiDomain } from "@macrostrat-web/settings";
22

33
export async function data() {
44
const url = `${apiDomain}/api/pg/strat_concepts_test?limit=20&concept_id=gt.0&order=concept_id.asc`;
5-
const res = await fetch(url)
6-
.then((r) => {return r.json()});
5+
const res = await fetch(url).then((r) => {
6+
return r.json();
7+
});
78
return { res };
89
}

pages/lex/strat-names/+Page.client.ts

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function StratPage({ show }) {
3131
const prevInputRef = useRef(input);
3232
const prevShowConceptsRef = useRef(showConcepts);
3333
const prevShowNamesRef = useRef(showNames);
34-
console.log("lastID", lastID);
34+
console.log("lastID", lastID);
3535

3636
useEffect(() => {
3737
if (
@@ -52,9 +52,7 @@ export function StratPage({ show }) {
5252
if (
5353
result &&
5454
data[data.length - 1]?.[showConcepts ? "concept_id" : "id"] !==
55-
result[result.length - 1]?.[
56-
showConcepts ? "concept_id" : "id"
57-
]
55+
result[result.length - 1]?.[showConcepts ? "concept_id" : "id"]
5856
) {
5957
setData((prevData) => {
6058
return [...prevData, ...result];
@@ -70,14 +68,25 @@ export function StratPage({ show }) {
7068

7169
return h(ContentPage, [
7270
h(StickyHeader, { className: "header" }, [
73-
h(PageBreadcrumbs, { title: showNames && showConcepts ? "Strat Names & Concepts" : showNames ? "Strat Names" : "Strat Concepts" }),
71+
h(PageBreadcrumbs, {
72+
title:
73+
showNames && showConcepts
74+
? "Strat Names & Concepts"
75+
: showNames
76+
? "Strat Names"
77+
: "Strat Concepts",
78+
}),
7479
h("div.header-description", [
75-
h('div.card-container', [
76-
h('div', { className: "status " + (showNames ? "active" : "inactive") }),
80+
h("div.card-container", [
81+
h("div", {
82+
className: "status " + (showNames ? "active" : "inactive"),
83+
}),
7784
h(
7885
Card,
7986
{
80-
className: "strat-name-card " + (!showNames || showConcepts ? "clickable" : ""),
87+
className:
88+
"strat-name-card " +
89+
(!showNames || showConcepts ? "clickable" : ""),
8190
onClick: () => {
8291
if (!showNames || showConcepts) {
8392
setShowNames(!showNames);
@@ -92,12 +101,16 @@ export function StratPage({ show }) {
92101
]
93102
),
94103
]),
95-
h('div.card-container', [
96-
h('div', { className: "status " + (showConcepts ? "active" : "inactive") }),
104+
h("div.card-container", [
105+
h("div", {
106+
className: "status " + (showConcepts ? "active" : "inactive"),
107+
}),
97108
h(
98109
Card,
99110
{
100-
className: "strat-concept-card " + (showNames || !showConcepts ? "clickable" : ""),
111+
className:
112+
"strat-concept-card " +
113+
(showNames || !showConcepts ? "clickable" : ""),
101114
onClick: () => {
102115
if (showNames || !showConcepts) {
103116
setShowConcepts(!showConcepts);
@@ -138,7 +151,12 @@ function StratItem({ data }) {
138151

139152
return h(
140153
LinkCard,
141-
{ href: `/lex/${isConcept ? "strat-name-concepts/" + concept_id : "strat-names/" + id}`, className: isConcept ? "strat-concept-card" : "strat-name-card" },
154+
{
155+
href: `/lex/${
156+
isConcept ? "strat-name-concepts/" + concept_id : "strat-names/" + id
157+
}`,
158+
className: isConcept ? "strat-concept-card" : "strat-name-card",
159+
},
142160
isConcept ? ConceptBody({ data }) : StratBody({ data })
143161
);
144162
}
@@ -148,7 +166,14 @@ function StratBody({ data }) {
148166

149167
return h("div.strat-body", [
150168
h("strong", name),
151-
h.if(concept_id)(Link, { className: "concept-tag", href: `/lex/strat-name-concepts/${concept_id}` }, concept_name),
169+
h.if(concept_id)(
170+
Link,
171+
{
172+
className: "concept-tag",
173+
href: `/lex/strat-name-concepts/${concept_id}`,
174+
},
175+
concept_name
176+
),
152177
]);
153178
}
154179

@@ -176,14 +201,21 @@ function useStratData(lastID, input, pageSize, showBoth, showNames) {
176201
const url1 = `${apiDomain}/api/pg/strat_names_test?limit=${pageSize}&id=gt.${lastID}&order=id.asc&name=ilike.*${input}*`;
177202
const url2 = `${apiDomain}/api/pg/strat_concepts_test?limit=${pageSize}&concept_id=gt.${lastID}&order=concept_id.asc&name=ilike.*${input}*`;
178203
const url3 = `${apiDomain}/api/pg/strat_combined_test?limit=${pageSize}&combined_id=gt.${lastID}&order=combined_id.asc&name=ilike.*${input}*`;
179-
const url = showBoth ? url3 : showNames ? url1 : url2;
204+
const url = showBoth ? url3 : showNames ? url1 : url2;
180205

181206
const result = useAPIResult(url);
182207

183208
return result;
184209
}
185210

186-
function LoadMoreTrigger({ data, setLastID, pageSize, result, showBoth, showNames }) {
211+
function LoadMoreTrigger({
212+
data,
213+
setLastID,
214+
pageSize,
215+
result,
216+
showBoth,
217+
showNames,
218+
}) {
187219
const ref = useRef(null);
188220

189221
useEffect(() => {

pages/lex/strat-names/+data.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { apiDomain } from "@macrostrat-web/settings";
22

33
export async function data() {
44
const url = `${apiDomain}/api/pg/strat_names_test?limit=20&id=gt.0&order=id.asc`;
5-
const res = await fetch(url)
6-
.then((r) => {return r.json()});
5+
const res = await fetch(url).then((r) => {
6+
return r.json();
7+
});
78
return { res };
89
}

0 commit comments

Comments
 (0)