-
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.
- Loading branch information
Showing
10 changed files
with
318 additions
and
116 deletions.
There are no files selected for viewing
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
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,52 @@ | ||
import React from "react"; | ||
import { Options } from "./options"; | ||
import { attributeOptions } from "./constants"; | ||
import classnames from "classnames"; | ||
import { IStateOptions } from "./types"; | ||
|
||
import css from "./options.scss"; | ||
|
||
interface IProps { | ||
handleSetSelectedOptions: (option: string, value: string|string[]) => void; | ||
selectedOptions: IStateOptions; | ||
} | ||
|
||
export const AttributeOptions: React.FC<IProps> = (props) => { | ||
const {handleSetSelectedOptions, selectedOptions} = props; | ||
|
||
const commonProps = { | ||
inputType: "checkbox" as "checkbox"|"radio", | ||
handleSetSelectedOptions, | ||
selectedOptions | ||
}; | ||
|
||
const getClasses = (key: string) => { | ||
if (key === "cropUnits" || key === "crops") { | ||
return classnames(css.checkOptions, css.narrow); | ||
} else { | ||
return classnames(css.checkOptions, css.vertical) | ||
Check warning on line 27 in src/components/attribute-options.tsx GitHub Actions / Build and Run Jest Tests
|
||
} | ||
} | ||
Check warning on line 29 in src/components/attribute-options.tsx GitHub Actions / Build and Run Jest Tests
|
||
|
||
return ( | ||
<> | ||
{ | ||
attributeOptions.map((attr) => { | ||
return ( | ||
<> | ||
{attr.label && <div className={css.category}>{attr.label}</div>} | ||
{attr.instructions && <div className={css.instructions}>{attr.instructions}</div>} | ||
<div className={classnames(getClasses(attr.key))}> | ||
<Options | ||
options={attr.options} | ||
optionKey={attr.key} | ||
{...commonProps} | ||
/> | ||
</div> | ||
</> | ||
) | ||
Check warning on line 47 in src/components/attribute-options.tsx GitHub Actions / Build and Run Jest Tests
|
||
}) | ||
} | ||
</> | ||
); | ||
}; |
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.