File tree Expand file tree Collapse file tree 6 files changed +28
-12
lines changed
components/layout/Documentation Expand file tree Collapse file tree 6 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,13 @@ const CardDocs = () => {
1616 ` } >
1717 < Documentation . ComponentHero codeUsage = { codeUsage } >
1818 < Card data-accent-color = "green" className = "bg-gray-50 text-gray-950 flex items-center space-x-2" >
19- < Avatar fallback = "PK " />
19+ < Avatar fallback = "PP " />
2020 < div >
2121 < div className = "font-medium" >
22- Peter Kowalsky
22+ Peter Parker
2323 </ div >
2424 < div className = "text-xs text-gray-800" >
25- Content Engineer
25+ Biochemist
2626 </ div >
2727 </ div >
2828 </ Card >
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const AvatarDocs = () => {
1414 Headings are used to display titles and subtitles.
1515 ` } >
1616 < Documentation . ComponentHero codeUsage = { codeUsage } >
17- < div className = 'text-gray-50 p-5 space-y-1' >
17+ < div className = 'text-gray-1000 p-5 space-y-1' >
1818 < Heading > Heading 1</ Heading >
1919 < Heading as = "h2" > Heading 2</ Heading >
2020 < Heading as = "h3" > Heading 3</ Heading >
Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ const AvatarDocs = () => {
1515 Separator is used to separate content.
1616 ` } >
1717 < Documentation . ComponentHero codeUsage = { codeUsage } >
18- < div className = 'text-gray-50 font-normal p-5 space-y-1' >
18+ < div className = 'text-gray-1000 font-normal p-5 space-y-1' >
1919 < div >
2020 < Text > Welcome to Rad UI</ Text >
2121 </ div >
2222 < Separator />
23- < div className = 'flex' style = { { height : "20px" } } >
23+ < div className = 'flex' >
2424 < Text > Modern</ Text >
2525 < Separator orientation = "vertical" />
2626 < Text > Accessible</ Text >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const TextDocs = () => {
1313 Text is used to display customizable text content.
1414 ` } >
1515 < Documentation . ComponentHero codeUsage = { codeUsage } >
16- < div className = 'text-gray-50 p-5 space-y-1' >
16+ < div className = 'text-gray-1000 p-5 space-y-1' >
1717 < Text > This is an example of the Text component</ Text >
1818 </ div >
1919 </ Documentation . ComponentHero >
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ const AvatarDocs = () => {
2222 < Documentation . ComponentHero codeUsage = { codeUsage } >
2323
2424 < Card className = "bg-gray-50" style = { { display : "flex" , gap : 20 } } >
25- < Tooltip content = "Tooltip content" >
25+ < Tooltip label = "Tooltip content" >
2626 < Text className = "text-gray-950" > Hello Tooltip. Hover Me!</ Text >
2727 </ Tooltip >
2828 </ Card >
Original file line number Diff line number Diff line change 1-
1+ "use client"
22
33const LinkIcon = ( ) => {
44 return < svg width = "24" height = "24" viewBox = "0 0 15 15" fill = "none" xmlns = "http://www.w3.org/2000/svg" > < path d = "M4.62471 4.00001L4.56402 4.00001C4.04134 3.99993 3.70687 3.99988 3.4182 4.055C2.2379 4.28039 1.29846 5.17053 1.05815 6.33035C0.999538 6.61321 0.999604 6.93998 0.999703 7.43689L0.999711 7.50001L0.999703 7.56313C0.999604 8.06004 0.999538 8.38681 1.05815 8.66967C1.29846 9.8295 2.2379 10.7196 3.4182 10.945C3.70688 11.0001 4.04135 11.0001 4.56403 11L4.62471 11H5.49971C5.77585 11 5.99971 10.7762 5.99971 10.5C5.99971 10.2239 5.77585 10 5.49971 10H4.62471C4.02084 10 3.78907 9.99777 3.60577 9.96277C2.80262 9.8094 2.19157 9.21108 2.03735 8.46678C2.00233 8.29778 1.99971 8.08251 1.99971 7.50001C1.99971 6.91752 2.00233 6.70225 2.03735 6.53324C2.19157 5.78895 2.80262 5.19062 3.60577 5.03725C3.78907 5.00225 4.02084 5.00001 4.62471 5.00001H5.49971C5.77585 5.00001 5.99971 4.77615 5.99971 4.50001C5.99971 4.22387 5.77585 4.00001 5.49971 4.00001H4.62471ZM10.3747 5.00001C10.9786 5.00001 11.2104 5.00225 11.3937 5.03725C12.1968 5.19062 12.8079 5.78895 12.9621 6.53324C12.9971 6.70225 12.9997 6.91752 12.9997 7.50001C12.9997 8.08251 12.9971 8.29778 12.9621 8.46678C12.8079 9.21108 12.1968 9.8094 11.3937 9.96277C11.2104 9.99777 10.9786 10 10.3747 10H9.49971C9.22357 10 8.99971 10.2239 8.99971 10.5C8.99971 10.7762 9.22357 11 9.49971 11H10.3747L10.4354 11C10.9581 11.0001 11.2925 11.0001 11.5812 10.945C12.7615 10.7196 13.701 9.8295 13.9413 8.66967C13.9999 8.38681 13.9998 8.06005 13.9997 7.56314L13.9997 7.50001L13.9997 7.43688C13.9998 6.93998 13.9999 6.61321 13.9413 6.33035C13.701 5.17053 12.7615 4.28039 11.5812 4.055C11.2925 3.99988 10.9581 3.99993 10.4354 4.00001L10.3747 4.00001H9.49971C9.22357 4.00001 8.99971 4.22387 8.99971 4.50001C8.99971 4.77615 9.22357 5.00001 9.49971 5.00001H10.3747ZM5.00038 7C4.72424 7 4.50038 7.22386 4.50038 7.5C4.50038 7.77614 4.72424 8 5.00038 8H10.0004C10.2765 8 10.5004 7.77614 10.5004 7.5C10.5004 7.22386 10.2765 7 10.0004 7H5.00038Z" fill = "currentColor" fillRule = "evenodd" clipRule = "evenodd" > </ path > </ svg >
55}
66
77export const BookMarkLink = ( { children, id } ) => {
88 const sanitizedId = id . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 - ] / g, '-' ) ;
9+
10+ const scrollToElement = ( e ) => {
11+ e . preventDefault ( ) ;
12+ const element = document . getElementById ( sanitizedId ) ;
13+ const offset = 80 ; // Adjust this value based on your header height
14+ const elementPosition = element . getBoundingClientRect ( ) . top ;
15+ const offsetPosition = elementPosition + window . pageYOffset - offset ;
16+
17+ window . scrollTo ( {
18+ top : offsetPosition ,
19+ behavior : 'smooth'
20+ } ) ;
21+
22+ // Update URL without triggering another scroll
23+ window . history . pushState ( { } , '' , `#${ sanitizedId } ` ) ;
24+ } ;
25+
926 return (
1027 < div id = { sanitizedId } >
1128 < a
1229 className = 'flex items-center space-x-4'
1330 href = { `#${ sanitizedId } ` }
31+ onClick = { scrollToElement }
1432 aria-label = { `Direct link to ${ id } ` }
1533 >
16- < span >
17- { children }
18- </ span >
34+ < span > { children } </ span >
1935 < LinkIcon />
2036 </ a >
2137 </ div >
You can’t perform that action at this time.
0 commit comments