-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New local list component as a wrapper for the Designsystem List (#627)
* created new local List component as a wrapper for the Designsystem List * PR fixes
- Loading branch information
Showing
18 changed files
with
176 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.borderedList { | ||
--borderStyle: dashed; | ||
margin-bottom: 0.5rem; | ||
padding-left: 0; | ||
border-top-color: #bcc7cc; | ||
border-top-width: 1px; | ||
border-top-style: var(--borderStyle); | ||
} | ||
|
||
.dashed { | ||
--borderStyle: dashed; | ||
} | ||
|
||
.solid { | ||
--borderStyle: solid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { ListProps } from '@digdir/design-system-react'; | ||
import { List } from '@digdir/design-system-react'; | ||
import cn from 'classnames'; | ||
import * as React from 'react'; | ||
|
||
import classes from './BorderedList.module.css'; | ||
|
||
export type BorderedListProps = { | ||
/** | ||
* Style of the border separating the items | ||
*/ | ||
borderStyle?: 'solid' | 'dashed'; | ||
} & ListProps; | ||
|
||
export const BorderedList = ({ | ||
borderStyle = 'dashed', | ||
children, | ||
className, | ||
...rest | ||
}: BorderedListProps) => { | ||
return ( | ||
<List | ||
className={cn(classes.borderedList, { [classes[borderStyle]]: borderStyle }, className)} | ||
style={{ paddingLeft: 0 }} | ||
{...rest} | ||
> | ||
{children} | ||
</List> | ||
); | ||
}; |
15 changes: 15 additions & 0 deletions
15
src/components/BorderedList/BorderedListItem/BorderedListItem.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.borderedListItem { | ||
--borderStyle: dashed; | ||
border-bottom-color: #bcc7cc; | ||
border-bottom-width: 1px; | ||
border-bottom-style: var(--borderStyle); | ||
list-style: none; | ||
} | ||
|
||
.dashed { | ||
--borderStyle: dashed; | ||
} | ||
|
||
.solid { | ||
--borderStyle: solid; | ||
} |
31 changes: 31 additions & 0 deletions
31
src/components/BorderedList/BorderedListItem/BorderedListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { ListItemProps } from '@digdir/design-system-react'; | ||
import { List } from '@digdir/design-system-react'; | ||
import cn from 'classnames'; | ||
import * as React from 'react'; | ||
|
||
import classes from './BorderedListItem.module.css'; | ||
|
||
export type BorderedListItemProps = { | ||
/** | ||
* Style of the border separating the items | ||
*/ | ||
borderStyle?: 'solid' | 'dashed'; | ||
} & ListItemProps; | ||
|
||
export const BorderedListItem = ({ | ||
borderStyle = 'dashed', | ||
children, | ||
...rest | ||
}: BorderedListItemProps) => { | ||
return ( | ||
<List.Item | ||
className={cn(classes.borderedListItem, { [classes[borderStyle]]: borderStyle })} | ||
style={{ marginBottom: 0 }} | ||
{...rest} | ||
> | ||
{children} | ||
</List.Item> | ||
); | ||
}; | ||
|
||
BorderedListItem.displayName = 'BorderedList.Item'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { BorderedList as BorderedListRoot } from './BorderedList'; | ||
import { BorderedListItem } from './BorderedListItem/BorderedListItem'; | ||
|
||
export type { BorderedListProps } from './BorderedList'; | ||
export type { BorderedListItemProps } from './BorderedListItem/BorderedListItem'; | ||
|
||
type BorderedListComponent = typeof BorderedListRoot & { | ||
Item: typeof BorderedListItem; | ||
}; | ||
|
||
const BorderedList = BorderedListRoot as BorderedListComponent; | ||
|
||
BorderedList.Item = BorderedListItem; | ||
|
||
export { BorderedList, BorderedListItem }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,8 @@ | |
|
||
.listItemIcon { | ||
margin-right: 10px; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.middleText { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,5 +52,6 @@ | |
} | ||
|
||
.listContainer { | ||
margin-bottom: 40px; | ||
margin-top: 15px; | ||
margin-bottom: 30px; | ||
} |
Oops, something went wrong.