-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
43 additions
and
4 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.App { | ||
text-align: left; | ||
padding: 20px; | ||
width: 60%; | ||
} | ||
|
||
.App-logo { | ||
|
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
35 changes: 35 additions & 0 deletions
35
src/@optimizely/forms-react/src/components/elements/SubmitButtonElementBlock.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,35 @@ | ||
import { SubmitButton, isNullOrEmpty } from "@optimizely/forms-sdk"; | ||
import React from "react"; | ||
import { useElement } from "../../hooks/useElement"; | ||
import ElementWrapper from "../ElementWrapper"; | ||
|
||
interface SubmitButtonElementBlockProps{ | ||
element: SubmitButton | ||
} | ||
|
||
export const SubmitButtonElementBlock = (props: SubmitButtonElementBlockProps) => { | ||
const { element } = props; | ||
const { validatorClasses, extraAttr, checkVisible } = useElement(element); | ||
//TODO: Need to get submittable status from API | ||
const buttonDisableState = false; | ||
|
||
return ( | ||
<ElementWrapper isVisible={checkVisible()}> | ||
<button id={element.key} | ||
name="submit" | ||
type="submit" | ||
value={element.key} | ||
{...extraAttr} | ||
disabled={buttonDisableState} | ||
className={isNullOrEmpty(element.properties.image) | ||
? `Form__Element FormExcludeDataRebind FormSubmitButton ${validatorClasses}` | ||
: `Form__Element FormExcludeDataRebind FormSubmitButton FormImageSubmitButton ${validatorClasses}` | ||
} | ||
> | ||
{isNullOrEmpty(element.properties.image) ? element.properties.label : ( | ||
<img src={element.properties.image} alt={element.properties.label} /> | ||
)} | ||
</button> | ||
</ElementWrapper> | ||
); | ||
} |
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