diff --git a/src/styles/font-styles.js b/src/styles/font-styles.js index 75070078..4460330e 100644 --- a/src/styles/font-styles.js +++ b/src/styles/font-styles.js @@ -87,54 +87,27 @@ export default css` grid-template-columns: 20px 1fr; } + .m-markdown .callout-icon { + display: inline-block; + flex-shrink: 0; + grid-row: 1; + } + .m-markdown .info-blockquote { background: #f8f7fc; border: 1px solid #ccced8; } - .m-markdown .info-blockquote:before { - display: inline-block; - height: 20px; - width: 20px; - content: ''; - background: url('https://vtex-dev-portal-navigation.fra1.digitaloceanspaces.com/info.svg') - no-repeat 0 0; - background-size: 20px 20px; - position: absolute; - } - .m-markdown .warning-blockquote { background: #fff2d4; border: 1px solid #ffb100; } - .m-markdown .warning-blockquote:before { - display: inline-block; - height: 20px; - width: 20px; - content: ''; - background: url('https://vtex-dev-portal-navigation.fra1.digitaloceanspaces.com/warning.svg') - no-repeat 0 0; - background-size: 20px 20px; - position: absolute; - } - .m-markdown .danger-blockquote { background: #fdefef; border: 1px solid #dc5a41; } - .m-markdown .danger-blockquote:before { - display: inline-block; - height: 20px; - width: 20px; - content: ''; - background: url('https://vtex-dev-portal-navigation.fra1.digitaloceanspaces.com/danger.svg') - no-repeat 0 0; - background-size: 20px 20px; - position: absolute; - } - blockquote p{ grid-column: 2 / -1; margin: 0; diff --git a/src/utils/renderBlockquote.js b/src/utils/renderBlockquote.js index 4de9444a..527e34f3 100644 --- a/src/utils/renderBlockquote.js +++ b/src/utils/renderBlockquote.js @@ -1,3 +1,18 @@ +const calloutColors = { + info: '#8C929D', + warning: '#FFB100', + danger: '#DC5A41', +}; + +function calloutIcon(type) { + const fill = calloutColors[type] || calloutColors.info; + const glyph = type === 'info' + ? '' + : ''; + + return `${glyph}`; +} + export default function renderBlockquote(text) { const infoMarker = 'â„šī¸'; const bookMarker = '📘'; @@ -6,18 +21,18 @@ export default function renderBlockquote(text) { if (text.startsWith(`

${infoMarker}`)) { // Apply custom styling for the info blockquote - return `

${text.replace(infoMarker, '').trim()}
`; + return `
${calloutIcon('info')}${text.replace(infoMarker, '').trim()}
`; } if (text.startsWith(`

${bookMarker}`)) { // Apply custom styling for the info blockquote - return `

${text.replace(bookMarker, '').trim()}
`; + return `
${calloutIcon('info')}${text.replace(bookMarker, '').trim()}
`; } if (text.startsWith(`

${warningMarker} `)) { // Apply custom styling for the warning blockquote - return `

${text.replace(warningMarker, '').trim()}
`; + return `
${calloutIcon('warning')}${text.replace(warningMarker, '').trim()}
`; } if (text.startsWith(`

${dangerMarker} `)) { // Apply custom styling for the danger blockquote - return `

${text.replace(dangerMarker, '').trim()}
`; + return `
${calloutIcon('danger')}${text.replace(dangerMarker, '').trim()}
`; } // Default rendering for regular blockquotes - return `
${text}
`; + return `
${calloutIcon('info')}${text}
`; }