-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
1a15674
commit a8549b3
Showing
8 changed files
with
178 additions
and
1 deletion.
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
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,18 @@ | ||
@use "../../../scss/_variables" as *; | ||
|
||
@import "../../../node_modules/bootstrap/scss/mixins"; | ||
|
||
.legacy-description { | ||
padding-top: 1rem; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.legacy-checkbox { | ||
padding-left: 2rem; | ||
} | ||
|
||
.checkbox { | ||
cursor: pointer; | ||
margin-right: 1rem; | ||
} |
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,33 @@ | ||
// | ||
// Copyright Inrupt Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal in | ||
// the Software without restriction, including without limitation the rights to use, | ||
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the | ||
// Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
|
||
import { render } from "@testing-library/react"; | ||
import ToggleLegacy from "./ToggleLegacy"; | ||
|
||
describe("ToggleLegacy", () => { | ||
it("renders a ToggleLegacy component", () => { | ||
const { asFragment } = render( | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
<ToggleLegacy toggleOption="" toggleLegacy={() => {}} /> | ||
); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
}); |
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,59 @@ | ||
// | ||
// Copyright Inrupt Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal in | ||
// the Software without restriction, including without limitation the rights to use, | ||
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the | ||
// Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
import { useState } from "react"; | ||
import styles from "./ToggleLegacy.module.scss"; | ||
import Info from "../Info/Info"; | ||
|
||
export interface Props { | ||
toggleDescription: string; | ||
toggleValue: boolean; | ||
toggleLegacy: () => void; | ||
} | ||
|
||
export default function ToggleLegacy({ | ||
toggleDescription, | ||
toggleValue, | ||
toggleLegacy, | ||
}: Props) { | ||
return ( | ||
<div className={styles["legacy-description"]}> | ||
Select if your Pod needs Legacy support: | ||
<div className={styles["legacy-checkbox"]}> | ||
<input | ||
type="checkbox" | ||
className={styles.checkbox} | ||
checked={toggleValue} | ||
onChange={() => toggleLegacy()} | ||
aria-label="checkbox-toggle" | ||
aria-labelledby="toggle-legacy-label" | ||
data-testid="toggle-legacy" | ||
/>{" "} | ||
<> | ||
{"Legacy support"} | ||
<Info> | ||
<b>Legacy support: </b> | ||
{toggleDescription} | ||
</Info> | ||
</> | ||
</div> | ||
</div> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/components/ToggleLegacy/__snapshots__/ToggleLegacy.test.tsx.snap
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,26 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ToggleLegacy renders a ToggleLegacy component 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="legacy-description" | ||
> | ||
Select if your Pod needs Legacy support: | ||
<div | ||
class="legacy-checkbox" | ||
> | ||
<input | ||
aria-label="checkbox-toggle" | ||
aria-labelledby="toggle-legacy-label" | ||
class="checkbox" | ||
data-testid="toggle-legacy" | ||
type="checkbox" | ||
/> | ||
Legacy support | ||
<i | ||
class="bi bi-info-circle-fill info-circle" | ||
/> | ||
</div> | ||
</div> | ||
</DocumentFragment> | ||
`; |