diff --git a/src/components/Common/MultiFactorAuthentication.tsx b/src/components/Common/MultiFactorAuthentication.tsx index 3d2b832a2..8f8bb97fd 100644 --- a/src/components/Common/MultiFactorAuthentication.tsx +++ b/src/components/Common/MultiFactorAuthentication.tsx @@ -371,7 +371,7 @@ function SecurityKeyTable() { } // data that goes onto the table - const security_key_table_data = tokens.map((cred: CredentialType) => { + const securityKeyData = tokens.map((cred: CredentialType) => { // date created const date_created = cred.created_ts.slice(0, "YYYY-MM-DD".length); // date last used @@ -384,61 +384,87 @@ function SecurityKeyTable() { // verify button/ verified badge if (cred.verified) { btnVerify = ( - - - +
+ + +   + + + + +
); } else { btnVerify = ( - - handleVerifyWebauthnTokenFreja(cred.key)}> - - - handleVerifyWebauthnTokenBankID(cred.key)}> - - - +
+ + +   + handleVerifyWebauthnTokenFreja(cred.key)}> + + + handleVerifyWebauthnTokenBankID(cred.key)}> + + + +
); } return ( - - {cred.description} - - {date_created} - - - {date_success} - - {btnVerify} - - handleConfirmDeleteModal(cred.key)} - > - - } - mainText={ - - } - showModal={showConfirmRemoveSecurityKeyModal} - closeModal={() => setShowConfirmRemoveSecurityKeyModal(false)} - acceptModal={handleRemoveWebauthnToken} - acceptButtonText={} - /> - - + +
+
+ + +   + {cred.description} + + handleConfirmDeleteModal(cred.key)} + > +
+
+ + +   + + {date_created} + + + + +   + + {date_success} + +
+ + {btnVerify} +
+ + } + mainText={ + + } + showModal={showConfirmRemoveSecurityKeyModal} + closeModal={() => setShowConfirmRemoveSecurityKeyModal(false)} + acceptModal={handleRemoveWebauthnToken} + acceptButtonText={} + /> +
); }); @@ -449,31 +475,10 @@ function SecurityKeyTable() { return ( -

+

-

- - - - - - - - - - {security_key_table_data} - -
- - - - - - - - - -
+ + {securityKeyData}
); } diff --git a/src/styles/_figure.scss b/src/styles/_figure.scss index 0c0317dd0..d1c390b8f 100644 --- a/src/styles/_figure.scss +++ b/src/styles/_figure.scss @@ -77,3 +77,56 @@ figure, margin-bottom: 1.5rem; } } + +// SECURITY TABLE +figure.webauthn-token-holder { + display: grid; + grid-template-rows: 1fr; + padding: 0.5rem 1rem; + text-align: left; + margin: 0; + border-bottom: 1px solid $border-gray; + + &:last-of-type { + border-bottom: none; + margin-bottom: 1rem; + } + + & div:first-child { + display: flex; + justify-content: space-between; + } + + & div:nth-child(2) { + display: flex; + align-items: end; + column-gap: 1em; + + & p:last-child { + margin-left: 1rem; + } + } + + span { + font-size: 0.9rem; + margin-bottom: 0.2rem; + white-space: nowrap; + } + .verified { + strong { + font-family: $akkurat; + letter-spacing: 1px; + font-weight: 700; + padding: 0; + font-size: 0.75rem; + text-transform: uppercase; + } + } + .btn-link { + height: auto; + margin-right: 1rem; + } + button.btn-close { + justify-self: flex-end; + } +} diff --git a/src/styles/_tables.scss b/src/styles/_tables.scss index a29ba4ba0..d241a6d01 100644 --- a/src/styles/_tables.scss +++ b/src/styles/_tables.scss @@ -69,10 +69,6 @@ table { } } - & tr.webauthn-token-holder.verified { - color: $txt-black; - } - & tr { height: 3rem; @@ -199,40 +195,7 @@ caption { padding: 0.5rem; } } -.active-keys { - margin: 1rem 0; - - th { - border-width: 1px; - } - th, - td { - &:first-child { - width: 30%; - } - } - tr:last-child td { - padding-bottom: 1rem; - } - .btn-link { - height: auto; - margin-right: 1rem; - } - - @media (max-width: $bp-sm) { - th, - td { - &:nth-child(2), - &:nth-child(3) { - display: none; - } - &:nth-child(1) { - width: 50%; - } - } - } -} .keys { @extend code; tr { diff --git a/src/tests/Security-test.tsx b/src/tests/Security-test.tsx index 094310d6f..031a5d61b 100644 --- a/src/tests/Security-test.tsx +++ b/src/tests/Security-test.tsx @@ -58,8 +58,8 @@ test("renders security key as expected, with added security key", async () => { await linkToAdvancedSettings(); - expect(screen.getByRole("table")).toBeInTheDocument(); - expect(screen.getByRole("cell", { name: "touchID" })).toBeInTheDocument(); + expect(screen.getByRole("figure")).toBeInTheDocument(); + expect(screen.getByText("touchID")).toBeInTheDocument(); expect(screen.getByRole("button", { name: "BankID" })).toBeEnabled(); expect(screen.getByRole("button", { name: "Freja+" })).toBeEnabled(); }); @@ -190,7 +190,7 @@ test("api call webauthn/remove", async () => { }); await linkToAdvancedSettings(); await waitFor(() => { - expect(screen.getByRole("table")).toBeInTheDocument(); + expect(screen.getByRole("figure")).toBeInTheDocument(); }); });