-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1381 from KhalisFoundation/dev
Release merge
- Loading branch information
Showing
69 changed files
with
2,428 additions
and
603 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
|
||
export interface Collection { | ||
options: any, | ||
action: (attr: any) => {}, | ||
label: string, | ||
checked: any | ||
} | ||
interface CheckboxesProps { | ||
collections: Collection[] | ||
} | ||
|
||
const Checkboxes = (props: CheckboxesProps) => { | ||
const { collections } = props; | ||
|
||
const toggleCheckBox = (op: any, action: any) => () => { | ||
action(op); | ||
} | ||
|
||
const collectionsMarkup = collections.map((c) => { | ||
const { options, action, label, checked } = c; | ||
|
||
return ( | ||
<ul key={label} className="checkbox-container"> | ||
{options.map((option: string) => ( | ||
<li key={option} className="checkbox-item"> | ||
<input | ||
id={`checkbox-${label}-${option}`} | ||
type="checkbox" | ||
value={option} | ||
onChange={() => action(option)} | ||
checked={checked.includes(option)} | ||
className="checkbox-input" /> | ||
<span | ||
className={`fake-checkbox check-${option}`} | ||
onClick={toggleCheckBox(option, action)} > | ||
</span> | ||
<label | ||
htmlFor={`checkbox-${label}-${option}`} | ||
className="checkbox-item-label"> | ||
{option} | ||
</label> | ||
</li> | ||
))} | ||
</ul> | ||
) | ||
}); | ||
|
||
return ( | ||
<> | ||
{collectionsMarkup} | ||
</> | ||
) | ||
} | ||
|
||
|
||
export default Checkboxes; |
Oops, something went wrong.