@@ -32,10 +32,6 @@ const AsideBlock = styled.div`
3232 background-color: ${ ( { theme } ) => theme . asideBackground } ;
3333 font-size: .9em;
3434 line-height: 1.5em;
35- /* TODO: dynamically change border and text according to theme? */
36- /* light text: rgb(178, 151, 98) */
37- /* light border: */
38- /* border-left: 1px solid var(--primary-color); */
3935 border: 1px solid rgba(114, 143, 203, .5);
4036 border-left: 2px solid rgba(114, 143, 203, .5);
4137
@@ -47,7 +43,7 @@ const Pre = styled.pre`
4743 text-align: left;
4844 margin: 1em 0;
4945 padding: 0.5em;
50- /* TODO: is this doing anything ? */
46+ /* TODO: is this really doing much ? */
5147 & .token-line {
5248 line-height: 1.4em;
5349 height: 1.3em;
@@ -93,11 +89,6 @@ const Button = styled.button`
9389 font-weight: bold;
9490 display: block;
9591 margin: auto;
96- /* background-color: ${ ( { theme } ) => theme . secondaryColor } ;
97- &:hover {
98- background-color: ${ ( { theme } ) => theme . primaryColor } ;
99- color: ${ ( { theme } ) => theme . secondaryColor } ;
100- } */
10192`
10293const H3 = styled . h3 `
10394 font-size: 1.5em;
@@ -106,7 +97,11 @@ const H3 = styled.h3`
10697 font-family: 'Fjalla One', sans-serif;
10798 font-family: 'Cuprum', sans-serif;
10899`
109-
100+ const PostImg = styled . img `
101+ display: block;
102+ width: 100%;
103+ margin: 1em 0;
104+ `
110105function Post ( props ) {
111106 const [ articleBtmPos , setArticleBtmPos ] = useState ( 0 )
112107 // console.log('propsPost: ', props)
@@ -134,7 +129,7 @@ function Post(props) {
134129 if ( ! section . children [ i ] . marks ) {
135130 // console.log('paragraphBlock inline code')
136131 blockContent . push (
137- < InlineCodeMain >
132+ < InlineCodeMain key = { section . children [ i ] . _key } >
138133 { section . children [ i ] . str_content_inline }
139134 </ InlineCodeMain >
140135 )
@@ -292,6 +287,10 @@ function Post(props) {
292287 >
293288 < article >
294289 < h2 > { props . title } </ h2 >
290+ < PostImg
291+ src = { props . postImg . url }
292+ alt = { `Image of ${ props . postImg . description } by ${ props . postImg . creditLine } ` }
293+ />
295294 < PostDescription > { props . description } </ PostDescription >
296295 { /* // TODO: Add _updatedAt field? */ }
297296 < PostDate >
@@ -342,7 +341,10 @@ export async function getStaticPaths() {
342341export async function getStaticProps ( context ) {
343342 const { slug } = context . params
344343 const post = await client . fetch ( `
345- *[_type == "post" && slug.current == $slug][0]
344+ *[_type == "post" && slug.current == $slug][0]{
345+ ...,
346+ "postImg": image.asset->,
347+ }
346348 ` , { slug } )
347349 return { props : post }
348350}
0 commit comments