Skip to content

Commit 8e64c3a

Browse files
committed
Added a new admonition component - explore (learn more)
1 parent d8cf1a3 commit 8e64c3a

3 files changed

Lines changed: 82 additions & 0 deletions

File tree

‎docusaurus.config.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ const config = {
5656
path: CURRICULUM_PATH,
5757
routeBasePath: '/lessons',
5858
sidebarPath: require.resolve('./sidebars.js'),
59+
admonitions: {
60+
keywords: ['explore'],
61+
},
5962
editUrl: ({ docPath }) => {
6063
return `https://github.com/razorblade23/the-python-ledger/edit/main/curriculum/${docPath}`;
6164
},

‎src/css/custom.css‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,65 @@ kbd:hover {
202202
transform: translateY(1px);
203203
box-shadow: 0 1px 0 var(--ifm-color-emphasis-300);
204204
}
205+
206+
/* ==========================================================================
207+
5. EXPLORE ADMINITION CSS
208+
========================================================================== */
209+
210+
/* Base Light Theme */
211+
:root {
212+
--ifm-color-admonition-explore: #7c3aed;
213+
--ifm-color-admonition-explore-background: rgba(124, 58, 237, 0.08);
214+
}
215+
216+
/* Dark Mode Enhancements */
217+
[data-theme='dark'] .alert--explore {
218+
/* High contrast neon purple accent line */
219+
border-left-color: #d8b4fe !important;
220+
border-left-width: 4px;
221+
222+
/* Richer, distinctly visible purple container background */
223+
background-color: rgba(168, 85, 247, 0.22) !important;
224+
225+
/* Subtle border & outer glow to separate from page background */
226+
border-top: 1px solid rgba(216, 180, 254, 0.2);
227+
border-right: 1px solid rgba(216, 180, 254, 0.2);
228+
border-bottom: 1px solid rgba(216, 180, 254, 0.2);
229+
box-shadow: 0 4px 20px rgba(168, 85, 247, 0.15);
230+
}
231+
232+
/* Header Text & Icon Contrast */
233+
[data-theme='dark'] .alert--explore .admonition-heading h5,
234+
[data-theme='dark'] .alert--explore .admonition-icon {
235+
color: #e9d5ff !important;
236+
fill: none !important;
237+
}
238+
239+
/* Fix for broken icon wrapper square */
240+
.alert--explore .admonition-icon {
241+
background: transparent !important;
242+
border: none !important;
243+
}
244+
245+
/* Admonition Layout & Icon Fixes */
246+
.alert--explore {
247+
border-left-width: 4px;
248+
border-left-color: var(--ifm-color-admonition-explore);
249+
background-color: var(--ifm-color-admonition-explore-background);
250+
}
251+
252+
[data-theme='dark'] .alert--explore {
253+
/* Subtle glow to separate it from dark page backgrounds */
254+
box-shadow: 0 0 12px rgba(192, 132, 252, 0.08);
255+
}
256+
257+
/* Target Header & Icon Styling */
258+
.alert--explore .admonition-heading h5,
259+
.alert--explore .admonition-icon {
260+
color: var(--ifm-color-admonition-explore);
261+
}
262+
263+
.alert--explore .admonition-icon svg {
264+
stroke: var(--ifm-color-admonition-explore);
265+
fill: none;
266+
}

‎src/theme/Admonition/index.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import Admonition from '@theme-original/Admonition';
3+
4+
export default function AdmonitionWrapper(props) {
5+
if (props.type === 'explore') {
6+
return (
7+
<Admonition
8+
{...props}
9+
type="info"
10+
className={`alert--explore ${props.className || ''}`}
11+
icon="📚"
12+
title={props.title ?? 'Learn more'}
13+
/>
14+
);
15+
}
16+
return <Admonition {...props} />;
17+
}

0 commit comments

Comments
 (0)