File tree Expand file tree Collapse file tree 9 files changed +14
-139
lines changed
Expand file tree Collapse file tree 9 files changed +14
-139
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import type { FC } from 'react';
1616type WithSidebarProps = {
1717 navKeys : Array < NavigationKeys > ;
1818 context ?: Record < string , RichTranslationValues > ;
19- showProgressionIcons ?: boolean ;
2019} ;
2120
2221const WithSidebar : FC < WithSidebarProps > = ( { navKeys, context, ...props } ) => {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const LearnLayout: FC<PropsWithChildren> = ({ children }) => (
1414 < WithNavBar />
1515
1616 < Article >
17- < WithSideBar navKeys = { [ 'learn' ] } showProgressionIcons = { true } />
17+ < WithSideBar navKeys = { [ 'learn' ] } />
1818
1919 < div >
2020 < main >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 66 flex-col
77 gap-2;
88
9- /* Default item list spacing for non-progression groups */
9+ /* Default item list spacing for groups */
1010 .itemList {
1111 @apply flex
1212 flex-col
1313 gap-1;
1414 }
1515
16- & : not (.progression ) {
17- .groupName {
18- @apply px-2
19- py-1
20- text-xs
21- font-semibold
22- text-neutral-800
23- dark:text-neutral-600;
24- }
25- }
26-
27- & .progression {
28- @apply flex
29- flex-col
30- gap-4
31- text-sm
32- font-medium
16+ .groupName {
17+ @apply px-2
18+ py-1
19+ text-xs
20+ font-semibold
3321 text-neutral-800
34- dark:text-neutral-200;
35-
36- .itemList {
37- @apply relative
38- -left-1
39- flex
40- flex-col
41- gap-px
42- after:absolute
43- after:top-0
44- after:left-[0.45rem ]
45- after:z-10
46- after:h-full
47- after:w-px
48- after:bg-neutral-200
49- after:content-['' ]
50- dark:after:bg-neutral-800;
51-
52- a {
53- @apply first:before:absolute
54- first:before:bottom-[calc (50% +0.25rem )]
55- first:before:left-0
56- first:before:h-20
57- first:before:w-4
58- first:before:bg-white
59- first:before:content-['' ]
60- last:after:absolute
61- last:after:top-[calc (50% +0.25rem )]
62- last:after:left-0
63- last:after:h-20
64- last:after:w-4
65- last:after:bg-white
66- last:after:content-['' ]
67- first:dark:before:bg-neutral-950
68- last:dark:after:bg-neutral-950;
69- }
70- }
22+ dark:text-neutral-600;
7123 }
7224}
Original file line number Diff line number Diff line change @@ -13,35 +13,19 @@ type SidebarGroupProps = {
1313 as ?: LinkLike ;
1414 pathname ?: string ;
1515 className : string ;
16- showProgressionIcons ?: boolean ;
1716} ;
1817
1918const SidebarGroup : FC < SidebarGroupProps > = ( {
2019 groupName,
2120 items,
22- showProgressionIcons,
2321 className,
2422 ...props
2523} ) => (
26- < section
27- className = { classNames (
28- {
29- [ styles . group ] : true ,
30- [ styles . progression ] : showProgressionIcons ,
31- } ,
32- className
33- ) }
34- >
24+ < section className = { classNames ( styles . group , className ) } >
3525 < label className = { styles . groupName } > { groupName } </ label >
3626 < ul className = { styles . itemList } >
3727 { items . map ( ( { label, link } ) => (
38- < SidebarItem
39- key = { link }
40- label = { label }
41- link = { link }
42- showProgressionIcons = { showProgressionIcons }
43- { ...props }
44- />
28+ < SidebarItem key = { link } label = { label } link = { link } { ...props } />
4529 ) ) }
4630 </ ul >
4731 </ section >
Original file line number Diff line number Diff line change 2929 dark:text-neutral-200;
3030 }
3131
32- & .progression {
33- & .active {
34- @apply text-neutral-900
35- dark:text-white;
36-
37- .hexagonIcon {
38- @apply fill-green-500;
39- }
40- }
41-
42- .label {
43- @apply p-1;
44- }
45-
46- .hexagonIcon {
47- @apply shrink-0
48- fill-neutral-200
49- stroke-white
50- stroke-[4 ]
51- dark:fill-neutral-800
52- dark:stroke-neutral-950;
53- }
54- }
55-
56- & : not (.active ): not (.progression ): hover {
32+ & : not (.active ): hover {
5733 /* Apply hover background to the full item width */
5834 @apply bg-neutral-100
5935 dark:bg-neutral-900;
7147 }
7248 }
7349
74- & .active : not (. progression ) {
50+ & .active {
7551 /* Full-width active background and readable text */
7652 @apply bg-green-600
7753 text-white;
Original file line number Diff line number Diff line change 11import { ArrowUpRightIcon } from '@heroicons/react/24/solid' ;
2- import classNames from 'classnames' ;
32
43import BaseActiveLink from '#ui/Common/BaseActiveLink' ;
54
65import type { FormattedMessage , LinkLike } from '#ui/types' ;
76import type { FC } from 'react' ;
87
9- import ProgressionIcon from '../ProgressionIcon' ;
10-
118import styles from './index.module.css' ;
129
1310type SidebarItemProps = {
1411 label : FormattedMessage ;
1512 link : string ;
1613 as ?: LinkLike ;
1714 pathname ?: string ;
18- showProgressionIcons ?: boolean ;
1915} ;
2016
21- const SidebarItem : FC < SidebarItemProps > = ( {
22- label,
23- link,
24- showProgressionIcons = false ,
25- ...props
26- } ) => (
17+ const SidebarItem : FC < SidebarItemProps > = ( { label, link, ...props } ) => (
2718 < BaseActiveLink
28- className = { classNames ( {
29- [ styles . item ] : true ,
30- [ styles . progression ] : showProgressionIcons ,
31- } ) }
19+ className = { styles . item }
3220 href = { link }
3321 activeClassName = { styles . active }
3422 { ...props }
3523 >
36- { showProgressionIcons && < ProgressionIcon className = { styles . hexagonIcon } /> }
37-
3824 < div className = { styles . label } >
3925 < span > { label } </ span >
4026
Original file line number Diff line number Diff line change @@ -81,8 +81,5 @@ const args = {
8181} ;
8282
8383export const Default : Story = { args } ;
84- export const Progression : Story = {
85- args : { ...args , showProgressionIcons : true } ,
86- } ;
8784
8885export default { component : Sidebar } as Meta ;
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ type SidebarProps = {
1414 title : string ;
1515 onSelect : ( value : string ) => void ;
1616 as ?: LinkLike ;
17- showProgressionIcons ?: boolean ;
1817 placeholder ?: string ;
1918} ;
2019
@@ -24,7 +23,6 @@ const SideBar: FC<PropsWithChildren<SidebarProps>> = ({
2423 title,
2524 onSelect,
2625 as,
27- showProgressionIcons = false ,
2826 children,
2927 placeholder,
3028} ) => {
@@ -60,7 +58,6 @@ const SideBar: FC<PropsWithChildren<SidebarProps>> = ({
6058 items = { items }
6159 pathname = { pathname }
6260 as = { as }
63- showProgressionIcons = { showProgressionIcons }
6461 className = { styles . navigation }
6562 />
6663 ) ) }
You can’t perform that action at this time.
0 commit comments