-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: controls (previous action) for list item (#96)
- Loading branch information
1 parent
7a5fa9e
commit dfac742
Showing
15 changed files
with
171 additions
and
55 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
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 was deleted.
Oops, something went wrong.
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
13 changes: 8 additions & 5 deletions
13
lib/components/List/ListItemFooter.tsx → lib/components/List/ListItemControls.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 |
---|---|---|
@@ -1,27 +1,30 @@ | ||
import type { ReactNode } from 'react'; | ||
import { Badge, type BadgeProps } from '../Badge'; | ||
import { ContextMenu, type ContextMenuProps } from '../ContextMenu'; | ||
import { Icon, type IconName } from '../Icon'; | ||
import styles from './listItemFooter.module.css'; | ||
import styles from './listItemControls.module.css'; | ||
|
||
interface ListItemFooterProps { | ||
interface ListItemControlsProps { | ||
badge?: BadgeProps; | ||
linkText?: string; | ||
linkIcon?: IconName; | ||
menu?: ContextMenuProps; | ||
children?: ReactNode; | ||
} | ||
|
||
export const ListItemFooter = ({ badge, linkText, linkIcon, children }: ListItemFooterProps) => { | ||
export const ListItemControls = ({ badge, linkText, linkIcon, menu, children }: ListItemControlsProps) => { | ||
return ( | ||
<footer className={styles.footer}> | ||
<div className={styles.controls} data-menu={menu && true}> | ||
{children ? ( | ||
children | ||
) : ( | ||
<> | ||
{badge && <Badge {...badge} />} | ||
{linkText && <span className={styles.linkText}>{linkText}</span>} | ||
{linkIcon && <Icon name={linkIcon} className={styles.linkIcon} />} | ||
{menu && <ContextMenu {...menu} className={styles.menu} />} | ||
</> | ||
)} | ||
</footer> | ||
</div> | ||
); | ||
}; |
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,25 @@ | ||
import cx from 'classnames'; | ||
import type { ChangeEventHandler } from 'react'; | ||
import { CheckboxIcon } from '../Icon/'; | ||
import type { ListItemSize } from './ListItemBase'; | ||
import styles from './listItemSelect.module.css'; | ||
|
||
export type ListItemSelectProps = { | ||
size?: ListItemSize; | ||
checked?: boolean; | ||
onChange?: ChangeEventHandler; | ||
className?: string; | ||
}; | ||
|
||
/** | ||
* Dialog checkbox | ||
*/ | ||
|
||
export const ListItemSelect = ({ size, checked = false, onChange, className }: ListItemSelectProps) => { | ||
return ( | ||
<label className={cx(styles.label, className)} data-size={size}> | ||
<input type="checkbox" checked={checked} onChange={onChange} className={styles.input} tabIndex={-1} /> | ||
<CheckboxIcon hover={true} checked={checked} className={styles.icon} /> | ||
</label> | ||
); | ||
}; |
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
export * from './ListItemBase'; | ||
export * from './ListItemHeader'; | ||
export * from './ListItemFooter'; | ||
export * from './ListItemLabel'; | ||
export * from './ListItemMedia'; | ||
export * from './ListItemControls'; | ||
export * from './ListItemSelect'; | ||
export * from './ListItem'; | ||
export * from './ListBase'; | ||
export * from './List'; |
This file was deleted.
Oops, something went wrong.
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
10 changes: 8 additions & 2 deletions
10
...components/List/listItemFooter.module.css → ...mponents/List/listItemControls.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
Oops, something went wrong.