-
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
13 changed files
with
147 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="registration-form"> | ||
<div class="registration-form__info"> | ||
<h3>Sign up for Cats Weekly™️</h3> | ||
<p>Just fill in the information below and we'll keep you up to date with all the latest and greatest news about | ||
cats.</p> | ||
</div> | ||
<div class="registration-form__fields"> | ||
<input placeholder="First Name" /> | ||
<input placeholder="Last Name" /> | ||
<input placeholder="Email Address" /> | ||
<input placeholder="How many cats do you own?" /> | ||
</div> | ||
<div class="registration-form__actions"> | ||
<button {{on "click" (fn this.handleSubmit)}}>Sign up</button> | ||
</div> | ||
</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,17 @@ | ||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { action } from '@ember/object'; | ||
import { RegistrationSchema } from '../validators/registration-form'; | ||
|
||
export default class RegistrationFormComponent extends Component { | ||
constructor() { | ||
super(...arguments); | ||
this.formSchema = RegistrationSchema; | ||
} | ||
|
||
@action | ||
async handleSubmit(evt) { | ||
// eslint-disable-next-line | ||
console.log(evt); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
body { | ||
font-family: 'Roboto', sans-serif; | ||
} | ||
@import './app/main'; | ||
@import './components/main'; |
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 @@ | ||
@import './theme.scss'; |
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,3 @@ | ||
body { | ||
font-family: 'Roboto', sans-serif; | ||
} |
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 @@ | ||
@import './registration-form.scss'; |
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,58 @@ | ||
$border-color: #ddd; | ||
$button-background-color: #ff3d3d; | ||
$button-text-color: white; | ||
$focus-ring-color: #b1c2de; | ||
|
||
// Workshop Exercise Styles | ||
|
||
.registration-form input { | ||
} | ||
|
||
.registration-form button { | ||
background: $button-background-color; | ||
color: $button-text-color; | ||
} | ||
|
||
.registration-form input:focus, | ||
.registration-form button:focus { | ||
outline: 3px solid $focus-ring-color; | ||
} | ||
|
||
// End Workshop Exercise Styles | ||
|
||
|
||
// Layout Styles | ||
// These should not need to be adjusted for the workshop. | ||
|
||
.registration-form { | ||
margin: 0 auto; | ||
max-width: 36rem; | ||
padding: 0 1rem 1rem 1rem; | ||
border: 1px solid $border-color; | ||
border-radius: 3px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.registration-form__fields { | ||
display: flex; | ||
flex-direction: column; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.registration-form__fields input { | ||
font-size: 1rem; | ||
border-radius: 3px; | ||
appearance: none; | ||
border: 1px solid $border-color; | ||
padding: 0.375rem 0.5rem; | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
.registration-form__actions button { | ||
font-size: 1rem; | ||
border-radius: 3px; | ||
border: none; | ||
padding: 0.375rem 0.5rem; | ||
width: 100%; | ||
} |
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,2 +1,2 @@ | ||
<h1>Ember a11y Form Workshop</h1> | ||
{{outlet}} | ||
<RegistrationForm /> |
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,8 @@ | ||
import * as yup from 'yup'; | ||
|
||
export const RegistrationSchema = yup.object().shape({ | ||
firstName: yup.string().required().label('First Name'), | ||
lastName: yup.string().required().label('Last Name'), | ||
emailAddress: yup.string().email().required().label('Last Name'), | ||
catsOwned: yup.number().required().label('Number of cats you own') | ||
}); |
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,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"experimentalDecorators": true | ||
}, | ||
"exclude": ["node_modules", "dist"] | ||
} |
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 @@ | ||
import { module, test } from 'qunit'; | ||
import { visit, currentURL } from '@ember/test-helpers'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
// import a11yAudit from 'ember-a11y-testing/test-support/audit'; | ||
|
||
module('Acceptance | visit registration page', function(hooks) { | ||
setupApplicationTest(hooks); | ||
|
||
test('visiting /', async function(assert) { | ||
await visit('/'); | ||
|
||
assert.equal(currentURL(), '/'); | ||
|
||
// await a11yAudit(); | ||
}); | ||
}); |
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,17 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
// import a11yAudit from 'ember-a11y-testing/test-support/audit'; | ||
|
||
module('Integration | Component | registration-form', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function (assert) { | ||
await render(hbs`<RegistrationForm />`); | ||
|
||
assert.dom(this.element).exists(); | ||
|
||
// await a11yAudit(this.element); | ||
}); | ||
}); |