File tree Expand file tree Collapse file tree 5 files changed +73
-0
lines changed
packages/components/all/src Expand file tree Collapse file tree 5 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+ import styles from "./styles/index.module.scss" ;
3+
4+ export interface CollapseProps extends React . DetailsHTMLAttributes < HTMLDetailsElement > {
5+ header : NonNullable < React . ReactNode > ;
6+ }
7+
8+ export const Collapse = ( {
9+ header,
10+ children,
11+ className,
12+ ...otherProps
13+ } : Readonly < CollapseProps > ) : React . ReactElement => (
14+ < details { ...otherProps } >
15+ < summary className = { styles . header } > { header } </ summary >
16+ { children }
17+ </ details >
18+ ) ;
Original file line number Diff line number Diff line change 1+ .header {
2+ appearance : auto ;
3+ cursor : pointer ;
4+ }
Original file line number Diff line number Diff line change @@ -9,3 +9,7 @@ export * from "./card";
99export * from "./container" ;
1010
1111export * from "./chip" ;
12+
13+ export * from "./collapse" ;
14+
15+ export * from "./list" ;
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+ import styles from "./styles/index.module.scss" ;
3+ import classNames from "classnames" ;
4+
5+ export interface ListProps extends Omit < React . HTMLAttributes < HTMLUListElement > , "children" > {
6+ skin ?: "bordered" ;
7+ items : React . ReactNode [ ] ;
8+ }
9+
10+ export const List = ( {
11+ skin,
12+ items,
13+ className,
14+ ...otherProps
15+ } : Readonly < ListProps > ) : React . ReactElement => (
16+ < ul className = { classNames ( styles . root , skin && styles [ skin ] , className ) } { ...otherProps } >
17+ { items . map ( ( item , key ) => (
18+ < li key = { `${ item ?. toString ( ) } -${ key . toString ( ) } ` } className = { styles . item } >
19+ { item }
20+ </ li >
21+ ) ) }
22+ </ ul >
23+ ) ;
Original file line number Diff line number Diff line change 1+ @import " @rck/theme" ;
2+
3+ .root {
4+ --border-color : transparent ;
5+
6+ margin : 0 ;
7+ padding : 0 ;
8+ list-style : none ;
9+ border : solid 1px var (--border-color );
10+ border-radius : get-spacing (2 );
11+ overflow : hidden ;
12+ }
13+
14+ .item {
15+ padding : get-spacing (2 );
16+
17+ & :not (:first-child ) {
18+ border-top : solid 1px var (--border-color );
19+ }
20+ }
21+
22+ .bordered {
23+ --border-color : #{get-color (neutral100 )} ;
24+ }
You can’t perform that action at this time.
0 commit comments