-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug: #216
- Loading branch information
Showing
5 changed files
with
94 additions
and
85 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import classnames from 'classnames'; | ||
import {FC} from 'react'; | ||
import {Trans} from '@lingui/react'; | ||
|
||
import {Checkbox} from '@client/ui'; | ||
import {Lock} from '@client/ui/icons'; | ||
|
||
interface ToggleListProps { | ||
className?: string; | ||
items: Array<{ | ||
id: string; | ||
isLocked: boolean; | ||
defaultChecked: boolean; | ||
onClick: (checked: boolean) => void; | ||
}>; | ||
} | ||
|
||
const ToggleList: FC<ToggleListProps> = ({className, items}: ToggleListProps) => ( | ||
<div css={{width: '100%'}} role="none"> | ||
<ul | ||
className={classnames('sortable-list', className)} | ||
css={{ | ||
'.sortable-list__item': { | ||
cursor: 'default', | ||
}, | ||
}}> | ||
{items.map((item) => { | ||
const {id, isLocked, defaultChecked, onClick} = item; | ||
return ( | ||
<li | ||
className={classnames('sortable-list__item', { | ||
'sortable-list__item--is-locked': isLocked, | ||
})} | ||
key={id}> | ||
{isLocked ? <Lock /> : null} | ||
<div className="sortable-list__content sortable-list__content__wrapper"> | ||
<span className="sortable-list__content sortable-list__content--primary"> | ||
<Trans id={id} /> | ||
</span> | ||
{isLocked ? null : ( | ||
<span className="sortable-list__content sortable-list__content--secondary"> | ||
<Checkbox | ||
defaultChecked={defaultChecked} | ||
id={id} | ||
onClick={(event) => onClick((event.target as HTMLInputElement).checked)}> | ||
<Trans id="settings.ui.torrent.context.menu.items.show" /> | ||
</Checkbox> | ||
</span> | ||
)} | ||
</div> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</div> | ||
); | ||
|
||
ToggleList.defaultProps = { | ||
className: undefined, | ||
}; | ||
|
||
export default ToggleList; |
81 changes: 25 additions & 56 deletions
81
...t/src/javascript/components/modals/settings-modal/lists/TorrentContextMenuActionsList.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
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