-
Notifications
You must be signed in to change notification settings - Fork 10
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 #309 from Infineon/233-review-switch
233 review switch
- Loading branch information
Showing
23 changed files
with
276 additions
and
309 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
48 changes: 48 additions & 0 deletions
48
examples/wrapper-components/react-javascript/src/components/Switch/Switch.js
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,48 @@ | ||
import React, { useState } from 'react'; | ||
import { IfxSwitch, IfxButton } from '@infineon/infineon-design-system-react'; | ||
|
||
function Switch() { | ||
const [disabled, setDisabled] = useState(false); | ||
const [switchChecked, setSwitchChecked] = useState(false); | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
console.log('Form submitted. Switch value:', switchChecked); | ||
}; | ||
|
||
const handleChange = (event) => { | ||
console.log("Updating switch value: ", event.detail); | ||
setSwitchChecked(event.detail); | ||
}; | ||
|
||
|
||
return ( | ||
<div> | ||
<form onSubmit={handleSubmit}> | ||
<IfxSwitch disabled={disabled} onIfxChange={handleChange} value={switchChecked}> | ||
label | ||
</IfxSwitch> | ||
<br /> | ||
|
||
<IfxButton type="submit">Submit</IfxButton> | ||
</form> | ||
<br /> | ||
<div> | ||
<IfxButton variant="outline" onClick={() => setDisabled(!disabled)}>Toggle Disabled</IfxButton> | ||
|
||
|
||
<IfxButton variant="outline" onClick={() => setSwitchChecked(!switchChecked)}>Toggle Value</IfxButton> | ||
|
||
</div> | ||
<br /> | ||
<span>Disabled: {String(disabled)} </span> | ||
<br /> | ||
|
||
<span>Value: {String(switchChecked)}</span> | ||
<br /> | ||
<br /> | ||
</div> | ||
); | ||
} | ||
|
||
export default Switch; |
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
16 changes: 16 additions & 0 deletions
16
examples/wrapper-components/vue-javascript/src/components/Switch.vue
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,16 @@ | ||
|
||
|
||
<template> | ||
<div> | ||
<h2>Switch</h2> | ||
<ifx-switch disabled="false" value="false" @ifxChange="console.log('switch changed')"></ifx-switch> | ||
<br /> | ||
<br /> | ||
</div> | ||
</template> | ||
|
||
|
||
|
||
|
||
|
||
|
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.