Skip to content

Commit

Permalink
feat: Better inline code highlight & bullet point style (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
riceball-tw committed May 25, 2024
1 parent de1d55b commit 4ce7f59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/short/ShortsList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const { shorts, currentSlug } = Astro.props

{/* Content */}
{
isActiveShort ? <div class="prose md:prose-2xl"><slot /></div> : ''
isActiveShort ? <div class="prose dark:prose-invert md:prose-2xl"><slot /></div> : ''
}
{/* Social */}
{short.data?.social ? <div class={`pt-4 ${(isActiveShort) ? '' : 'hidden'}`}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/post/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const tagHrefs = tags.map((tag) => `/post/tags/${tag}/`);
<article
data-pagefind-body
data-article
class="article-grid lg:px-auto prose mb-16 block w-full max-w-none px-8 dark:prose-invert dark:prose-dark md:prose-xl lg:grid"
class="article-grid lg:px-auto prose mb-16 block w-full max-w-none px-8 dark:prose-invert md:prose-xl lg:grid"
>
<header class="not-prose col-start-2 mb-16">
{
Expand Down
21 changes: 6 additions & 15 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default {
typography: ({ theme }: PluginUtils) => ({
DEFAULT: {
css: {
// Light Mode
'--tw-prose-body': theme('colors.surface.inverse'),
'--tw-prose-headings': theme('colors.surface.inverse'),
'--tw-prose-lead': theme('colors.surface.inverse'),
Expand All @@ -82,13 +83,14 @@ export default {
'--tw-prose-th-borders': theme('colors.primary[300] / 1'),
'--tw-prose-td-borders': theme('colors.primary[200] / 1'),

// Dark Mode
'--tw-prose-invert-body': theme('colors.surface.inverse'),
'--tw-prose-invert-headings': 'white',
'--tw-prose-invert-lead': theme('colors.surface.inverse'),
'--tw-prose-invert-links': theme('colors.surface.inverse'),
'--tw-prose-invert-bold': theme('colors.surface.inverse'),
'--tw-prose-invert-bold': theme('colors.highlight'),
'--tw-prose-invert-counters': theme('colors.surface.inverse'),
'--tw-prose-invert-bullets': theme('colors.surface.inverse'),
'--tw-prose-invert-bullets': theme('colors.primary[600] / 1'),
'--tw-prose-invert-hr': theme('colors.surface.inverse'),
'--tw-prose-invert-quotes': theme('colors.surface.inverse'),
'--tw-prose-invert-quote-borders': theme('colors.surface.inverse'),
Expand Down Expand Up @@ -128,20 +130,9 @@ export default {
borderRadius: theme('borderRadius.lg'),
scrollbarWidth: 'thin',
},

':not(pre) > code': {
padding: theme('spacing.1'),
'@apply bg-primary-200 bg-opacity-60 border border-primary-300': {},
},
},
},
dark: {
css: {
figcaption: {
'@apply border-primary-600': {},
},
':not(pre) > code': {
'@apply bg-primary-800 bg-opacity-60 border border-primary-700': {},
'@apply p-1 bg-primary-200 dark:bg-primary-800 bg-opacity-60 border border-primary-300 dark:border-primary-700 hover:bg-primary-200 hover:border-primary-400 dark:hover:bg-primary-700 dark:hover:border-primary-600 transition-colors':
{},
},
},
},
Expand Down

0 comments on commit 4ce7f59

Please sign in to comment.