Skip to content

Commit 534b2b8

Browse files
committed
css added
1 parent 76992ff commit 534b2b8

File tree

3 files changed

+109
-57
lines changed

3 files changed

+109
-57
lines changed

src/components/CBBaseInfo.jsx

+26-30
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
11
/**
22
* This is a custom Front Matter Component that takes the front matter and renders the api data
33
*/
4-
import React from 'react';
5-
import useFrontMatter from './useFrontMatter';
4+
import React from "react";
5+
import useFrontMatter from "./useFrontMatter";
66

77
const CBBaseInfo = () => {
88
const frontMatter = useFrontMatter();
9-
console.log(frontMatter)
9+
console.log(frontMatter);
1010
return (
11-
<div>
12-
{Object.entries(frontMatter).map(([key, value]) => {
13-
if (key === 'cbbaseinfo') {
14-
console.log(`Key: ${key}, Value: ${value}`);
15-
16-
return (
17-
<p key={key}>
18-
Description: {value.description}
19-
</p>
20-
);
21-
// return Object.entries(value).map(([cbkey, cbvalue]) => {
22-
// console.log(cbkey);
23-
// return (
24-
// <p key={cbkey}>
25-
// <strong>{cbkey}</strong>
26-
// <br/>
27-
// </p>
28-
// );
29-
// });
30-
}
31-
32-
return null;
33-
})}
34-
</div>
35-
);
36-
};
11+
<div>
12+
{Object.entries(frontMatter).map(([key, value]) => {
13+
if (key === "cbbaseinfo") {
14+
console.log(`Key: ${key}, Value: ${value}`);
3715

38-
export default CBBaseInfo;
16+
return <div className="description" key={key}>Description: {value.description}</div>;
17+
// return Object.entries(value).map(([cbkey, cbvalue]) => {
18+
// console.log(cbkey);
19+
// return (
20+
// <p key={cbkey}>
21+
// <strong>{cbkey}</strong>
22+
// <br/>
23+
// </p>
24+
// );
25+
// });
26+
}
27+
28+
return null;
29+
})}
30+
</div>
31+
);
32+
};
33+
34+
export default CBBaseInfo;

src/components/CBParameters.jsx

+62-25
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,68 @@
1-
/**
2-
* This is a custom Front Matter Component that takes the front matter and renders the api data
3-
*/
4-
import React from 'react';
5-
import useFrontMatter from './useFrontMatter';
1+
import React from "react";
2+
import useFrontMatter from "./useFrontMatter";
63

74
const CBParameters = () => {
85
const frontMatter = useFrontMatter();
6+
97
return (
10-
<div>
11-
{Object.entries(frontMatter).map(([key, value]) => {
12-
if (key === 'cbparameters') {
13-
if (value.parameters) {
14-
return value.parameters.map((param, index) => {
15-
console.log("Parameter"+param);
16-
return (
17-
<p key={index}>
18-
<strong>{param}</strong>
19-
<br/>
20-
</p>
21-
);
22-
});
8+
<div>
9+
{Object.entries(frontMatter).map(([key, value]) => {
10+
if (key === "cbparameters") {
11+
const hasParameters = value.parameters && value.parameters.length > 0;
12+
const hasReturns = value.returns && value.returns.signatureTypeName && value.returns.description;
13+
14+
return (
15+
<div>
16+
{hasParameters && (
17+
<div>
18+
<h3>Parameters</h3>
19+
<table className="table" >
20+
<thead>
21+
<tr>
22+
<th>Name</th>
23+
<th>Type</th>
24+
<th>Description</th>
25+
</tr>
26+
</thead>
27+
<tbody>
28+
{value.parameters.map((param, index) => (
29+
<tr key={index}>
30+
<td>{param.name}</td>
31+
<td>{param.typeName}</td>
32+
<td>{param.description}</td>
33+
</tr>
34+
))}
35+
</tbody>
36+
</table>
37+
</div>
38+
)}
39+
40+
{hasReturns && (
41+
<div>
42+
<h3>Returns</h3>
43+
<table className="table" >
44+
<thead>
45+
<tr>
46+
<th>Type</th>
47+
<th>Description</th>
48+
</tr>
49+
</thead>
50+
<tbody>
51+
<tr>
52+
<td>{value.returns.signatureTypeName}</td>
53+
<td>{value.returns.description}</td>
54+
</tr>
55+
</tbody>
56+
</table>
57+
</div>
58+
)}
59+
</div>
60+
);
2361
}
24-
}
25-
return null;
26-
})}
27-
</div>
28-
);
29-
};
62+
return null;
63+
})}
64+
</div>
65+
);
66+
};
3067

31-
export default CBParameters;
68+
export default CBParameters;

src/css/custom.css

+21-2
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,31 @@
3232
[data-theme="dark"] .navbar {
3333
background-color: rgba(34, 31, 29, 0.9);
3434
}
35+
3536
.navbar {
3637
background-color: rgba(255, 255, 255, 0.9);
3738
}
3839

40+
.table {
41+
width: 100%;
42+
margin-bottom: 20px;
43+
}
44+
45+
.description{
46+
margin-bottom: 20px;
47+
background-color: rgb(236, 234, 234);
48+
border: 2px solid #d8d4d4;
49+
color: black;
50+
width: fit-content;
51+
padding: 20px;
52+
border-radius: 5px;
53+
}
54+
[data-theme='dark'] .description{
55+
color: white;
56+
background-color: rgb(57, 56, 56);
57+
border: 2px solid #545050;
58+
}
3959
[data-theme='dark'] .footer {
4060
background-color: rgba(34, 31, 29, 0.9);
41-
42-
}
4361

62+
}

0 commit comments

Comments
 (0)