File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ type Props = {
3+ content: string | { heading: string ; subheading: string };
4+ };
5+
6+ let heading;
7+ let subheading;
8+
9+ if (typeof Astro .props .content === " string" ) {
10+ heading = Astro .props .content ;
11+ }
12+
13+ if (typeof Astro .props .content === " object" && Astro .props .content !== null ) {
14+ heading = Astro .props .content .heading ;
15+ subheading = Astro .props .content .subheading ;
16+ }
17+ ---
18+
19+ <h1 class:list ={ { " no-subheading" : typeof subheading !== " string" }} >
20+ { heading }
21+ </h1 >
22+ { typeof subheading === " string" && <p >{ subheading } </p >}
23+
24+ <style lang =" scss" >
25+ p {
26+ margin-bottom: v-size(8, "em");
27+ }
28+ .no-subheading {
29+ margin-bottom: v-size(5, "em");
30+ }
31+ </style >
Original file line number Diff line number Diff line change 11---
22import ItemCard from " @components/projects/item-card.astro" ;
3+ import Heading from " @components/ui/heading.astro" ;
34import Layout from " @layout/layout.astro" ;
45
56import eslintConfigMcecodeGif from " @assets/eslint-config-mcecode.gif" ;
@@ -10,7 +11,7 @@ import pdfMadeEasyGif from "@assets/pdf-made-easy.gif";
1011---
1112
1213<Layout title =" Projects" >
13- <h1 > Projects</ h1 >
14+ <Heading content = " Projects" / >
1415 <ul >
1516 <ItemCard
1617 title =" PDF Made Easy"
@@ -59,9 +60,3 @@ import pdfMadeEasyGif from "@assets/pdf-made-easy.gif";
5960 />
6061 </ul >
6162</Layout >
62-
63- <style lang =" scss" >
64- h1 {
65- margin-bottom: v-size(5, "em");
66- }
67- </style >
You can’t perform that action at this time.
0 commit comments