Skip to content

Commit 28a3a16

Browse files
Feat/code block (#495)
* feat: Add codeBlock component with responsive token and theme control * fix: Minor changes * fix: Minor fix * feat: Implement syntax highlighting and utility functions for CodeBlock component * chore: run prettier * fix: Adjust zIndex in Sidebar and update CodeBlock * refactor: Update padding structure in CodeBlock component * fix: Wrap Tooltip content in a Portal and adjust zIndex --------- Co-authored-by: Harshvardhan Agarwal <agarwal.harsh2021@gmail.com>
1 parent 0ef03f3 commit 28a3a16

File tree

12 files changed

+1940
-53
lines changed

12 files changed

+1940
-53
lines changed

apps/site/src/demos/CodeBlockDemo.tsx

Lines changed: 810 additions & 0 deletions
Large diffs are not rendered by default.

apps/site/src/demos/SidebarDemo.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Menu as MenuIcon,
66
BarChart2,
77
Type,
8+
Code,
89
Calendar as CalendarIcon,
910
ListFilter,
1011
User as UserIcon,
@@ -87,6 +88,7 @@ import KeyValuePairDemo from './KeyValuePairDemo'
8788
import AllComponentsDemo from './AllComponentsDemo'
8889
import SearchInputDemo from './SearchInputDemo'
8990
import VirtualListDemo from './VirtualListDemo'
91+
import CodeBlockDemo from './CodeBlockDemo'
9092

9193
const SidebarDemo = () => {
9294
const [activeComponent, setActiveComponent] = useState<
@@ -140,6 +142,7 @@ const SidebarDemo = () => {
140142
| 'dataRangePicker'
141143
| 'allComponents'
142144
| 'virtualList'
145+
| 'codeBlock'
143146
>('dataRangePicker')
144147

145148
const [activeTenant, setActiveTenant] = useState<string>('Juspay')
@@ -392,6 +395,8 @@ const SidebarDemo = () => {
392395
return <AllComponentsDemo />
393396
case 'virtualList':
394397
return <VirtualListDemo />
398+
case 'codeBlock':
399+
return <CodeBlockDemo />
395400
default:
396401
return (
397402
<div className="p-8">
@@ -801,6 +806,13 @@ const SidebarDemo = () => {
801806
isSelected: activeComponent === 'dataRangePicker',
802807
onClick: () => setActiveComponent('dataRangePicker'),
803808
},
809+
{
810+
label: 'Code Block',
811+
leftSlot: (
812+
<Code style={{ width: '16px', height: '16px' }} />
813+
),
814+
onClick: () => setActiveComponent('codeBlock'),
815+
},
804816
],
805817
},
806818
{

apps/site/src/index.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,17 @@
7373
font-display: swap;
7474
}
7575

76+
/* Smooth scrolling for the entire app */
77+
html {
78+
scroll-behavior: smooth;
79+
}
80+
81+
* {
82+
scroll-behavior: smooth;
83+
}
84+
7685
:root {
77-
--background: #fcfcfc;
86+
--background: #fcfcfd;
7887
--foreground: #171717;
7988
font-family: 'InterDisplay', sans-serif;
8089
line-height: 1.5;

0 commit comments

Comments
 (0)