@@ -32,12 +32,12 @@ const ArticleBlock = styled.div`
3232`
3333const AsideBlock = styled . div `
3434 margin-bottom: 1em;
35- padding: 1em 2em ;
35+ padding: 1em 1.5em ;
3636 background-color: ${ ( { theme } ) => theme . asideBackground } ;
3737 font-size: .9em;
3838 line-height: 1.5em;
3939 border: 1px solid rgba(114, 143, 203, .5);
40- border-left: 2px solid rgba(114, 143, 203, .5);
40+ /* border-left: 5px solid rgba(114, 143, 203, .5); */
4141`
4242const Pre = styled . pre `
4343 font-family: 'Fira Mono', monospace;
@@ -67,18 +67,17 @@ const InlineCodeMain = styled.span`
6767 background-color: ${ ( { theme } ) => theme . secondaryColor } ;
6868 padding: 1px 3px;
6969`
70+ // TODO: why does this format inline code in asideWithCode all wonky when I remove the 0 padding
7071const AsideCode = styled ( InlineCodeMain ) `
7172 padding: 0 5px;
72- margin-bottom: 1em;
73- font-family: 'Courier Prime', monospace;
7473`
7574const AsideCodeDescription = styled . p `
7675 margin-top: 1.1em;
7776 display: block;
7877 font-weight: 400;
7978`
8079const CodeNote = styled . p `
81- margin-top: -.5em;
80+ /* margin-top: -.5em; */
8281 margin-bottom: 1.2em;
8382 font-style: italic;
8483 color: ${ ( { theme } ) => theme . primaryColor } ;
@@ -99,6 +98,16 @@ const H3 = styled.h3`
9998 margin-top: 1.5em;
10099 font-family: 'Cuprum', sans-serif;
101100`
101+ const UL = styled . ul `
102+ margin-bottom: 15px;
103+ `
104+ const InfoIcon = styled . img `
105+ float: left;
106+ margin: 0 15px 0 0;
107+ @media screen and (max-width: 600px) {
108+ margin: 0 5px 0 0;
109+ }
110+ `
102111const ListItem = styled . li `
103112 /* &:before {
104113 content: ''
@@ -123,22 +132,18 @@ function Post(props) {
123132 }
124133
125134 function formatListItem ( listItemParts ) {
126- // console.log('formatListItem ', listItemParts)
127135 const listItem = [ ]
128136 for ( let i = 0 ; i < listItemParts . length ; i ++ ) {
129137 if ( listItemParts [ i ] . _type === 'inline_code' ) {
130138 listItem . push (
131- < InlineCodeMain key = { listItemParts . _key } >
139+ < InlineCodeMain key = { listItemParts [ i ] . _key } >
132140 { listItemParts [ i ] . str_content_inline }
133141 </ InlineCodeMain >
134142 )
135- }
136- else {
143+ } else {
137144 listItem . push ( listItemParts [ i ] . text )
138145 }
139-
140146 }
141- // console.log('listItem: ', listItem)
142147 return listItem
143148 }
144149
@@ -193,13 +198,17 @@ function Post(props) {
193198 const renderedLines = [ ]
194199 for ( let i = 0 ; i < contentArray . length ; i ++ ) {
195200 renderedLines . push (
196- < div key = { i } > { contentArray [ i ] } </ div >
201+ < p key = { i } > { contentArray [ i ] } </ p >
197202 )
198203 }
199- return < AsideBlock key = { _key } > { renderedLines } </ AsideBlock >
204+ return (
205+ < AsideBlock key = { _key } >
206+ { renderedLines }
207+ </ AsideBlock >
208+ )
200209 }
201210
202- function asideWithCode ( content , _key ) {
211+ function asideWithCode ( content , _key , isAsideNote ) {
203212 // console.log('asideWithCode: ', content)
204213 const renderedContent = [ ]
205214 for ( let i = 0 ; i < content . length ; i ++ ) {
@@ -227,6 +236,10 @@ function Post(props) {
227236 </ CodeNote >
228237 )
229238 }
239+ // aside note with no special formatting
240+ else if ( isAsideNote ) {
241+ renderedContent . push ( children [ 0 ] . text )
242+ }
230243 else {
231244 renderedContent . push (
232245 < AsideCodeDescription key = { children [ 0 ] . _key } >
@@ -236,7 +249,23 @@ function Post(props) {
236249 }
237250 }
238251 // console.log('renderedContent: ', renderedContent)
239- return < AsideBlock key = { _key } > { renderedContent } </ AsideBlock >
252+ return (
253+ < AsideBlock key = { _key } >
254+ { isAsideNote && (
255+ < InfoIcon
256+ src = "/info.svg"
257+ width = "40"
258+ height = "40"
259+ alt = "info icon"
260+ />
261+ ) }
262+ { renderedContent }
263+ </ AsideBlock >
264+ )
265+ }
266+
267+ function asideNote ( content , _key ) {
268+ return asideWithCode ( content , _key , true )
240269 }
241270
242271 function prismafyCodeBlock ( content , _key ) {
@@ -272,14 +301,15 @@ function Post(props) {
272301
273302 let list = [ ]
274303 props . body && props . body . forEach ( section => {
304+ // console.log('section._type: ', section._type)
275305 if ( section . listItem ) {
276306 list . push (
277307 < ListItem > { formatListItem ( section . children ) } </ ListItem >
278308 )
279309 } else {
280310 if ( list . length > 0 ) {
281311 postContent . push (
282- < ul > { list } </ ul >
312+ < UL > { list } </ UL >
283313 )
284314 list = [ ]
285315 }
@@ -301,12 +331,14 @@ function Post(props) {
301331 )
302332 )
303333 break
334+ case 'post_aside_note' :
335+ postContent . push (
336+ asideNote ( section . str_content , section . _key )
337+ )
338+ break
304339 case 'post_aside_with_code' :
305- // console.log('section.body: ', section.body)
306340 postContent . push (
307- asideWithCode (
308- section . body , section . _key
309- )
341+ asideWithCode ( section . body , section . _key )
310342 )
311343 break
312344 // default:
0 commit comments