-
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.
Merge pull request #214 from NIAEFEUP/feature/login-page
Login page
- Loading branch information
Showing
16 changed files
with
5,091 additions
and
8,664 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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 was deleted.
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
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
src/routes/(app)/login/_components/variable-visibility-input.stories.ts
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 { fireEvent, within } from '@storybook/testing-library'; | ||
import { expect } from '@storybook/jest'; | ||
import VariableVisibilityInput from './variable-visibility-input.svelte'; | ||
|
||
export default { | ||
title: 'Atoms/Inputs', | ||
component: VariableVisibilityInput, | ||
parameters: { | ||
layout: 'centered' | ||
} | ||
}; | ||
|
||
export const VariableVisibility = { | ||
play: async ({ canvasElement, step }) => { | ||
const canvas = within(canvasElement); | ||
|
||
await step('Check initial input type', async () => { | ||
const input = await canvas.findByTestId('password-input'); | ||
|
||
await expect(input).toHaveAttribute('type', 'password'); | ||
}); | ||
|
||
await step('Enter test text', async () => { | ||
const input = await canvas.findByTestId('password-input'); | ||
|
||
await fireEvent.change(input, { target: { value: 'test_password' } }); | ||
|
||
await expect(input).toHaveValue('test_password'); | ||
}); | ||
|
||
await step('Show password', async () => { | ||
const toggleButton = await canvas.findByRole('button'); | ||
|
||
await fireEvent.click(toggleButton); | ||
|
||
const input = await canvas.findByRole('textbox'); | ||
await expect(input).toHaveAttribute('type', 'text'); | ||
}); | ||
|
||
await step('Hide password', async () => { | ||
const toggleButton = await canvas.findByRole('button'); | ||
await fireEvent.click(toggleButton); | ||
|
||
const input = await canvas.findByTestId('password-input'); | ||
await expect(input).toHaveAttribute('type', 'password'); | ||
}); | ||
} | ||
}; |
27 changes: 27 additions & 0 deletions
27
src/routes/(app)/login/_components/variable-visibility-input.svelte
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,27 @@ | ||
<script lang="ts"> | ||
import Icon from '@/lib/components/icons/icon.svelte'; | ||
import Icons from '@/lib/components/icons/icons'; | ||
let visible = false; | ||
$: type = visible ? 'text' : 'password'; | ||
$: icon = visible ? Icons.Hidden : Icons.Visible; | ||
</script> | ||
|
||
<div class="relative"> | ||
<input | ||
{type} | ||
{...$$restProps} | ||
class="col-start-1 col-end-3 row-start-1 {$$props.class}" | ||
data-testid="password-input" | ||
aria-label="Password input" | ||
/> | ||
<button | ||
type="button" | ||
class="absolute inset-y-0 right-0 mr-4" | ||
on:click={() => (visible = !visible)} | ||
aria-label={visible ? 'Hide password' : 'Show password'} | ||
title={visible ? 'Hide password' : 'Show password'} | ||
> | ||
<Icon src={icon} size="1.5em" className="fill-rose-950/[.54]" /> | ||
</button> | ||
</div> |
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,15 @@ | ||
import Layout from '../+layout.svelte'; | ||
import Page from './+page.svelte'; | ||
import LayoutDecorator from '@/lib/storybook-utils/layout-decorator.svelte'; | ||
|
||
export default { | ||
title: 'Pages/Login', | ||
component: Page, | ||
parameters: { | ||
layout: 'fullscreen', | ||
backgrounds: { default: 'clear' } | ||
}, | ||
decorators: [() => Layout, () => LayoutDecorator] | ||
}; | ||
|
||
export const Login = {}; |
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