Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Input ~ input example #892

Merged
merged 3 commits into from May 9, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 52 additions & 0 deletions live-examples/html-examples/input/css/input.css
@@ -0,0 +1,52 @@
@font-face {
font-family: 'Fira Sans';
src: local('FiraSans-Regular'),
url('/media/fonts/FiraSans-Regular.woff2') format('woff2');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: indent with 4 spaces

}

legend {
background-color: #000;
color: #ffffff;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: Prefer short form when applicable #ffffff => #fff

padding: 3px 6px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: indent with 4 spaces

}

input,
label {
width: 43%;
}

input {
margin: 0.5rem 0;
padding: 0.5rem;
border-radius: 4px;
border: 1px solid #ddd;
outline: none;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: indent with 4 spaces. Do not remove outline as it negatively impacts accessibility, unless there is alternate styling provider for the active and focus states.

}

label {
display: inline-block;
font-size: .8rem;
}

input:invalid + span:after {
content: '✖';
color: red;
padding-left: 5px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: indent with 4 spaces

}

input:valid + span:after {
content: '✓';
color: green;
padding-left: 5px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: indent with 4 spaces

}

.warning {
font-size: 0.65rem;
color: #e67d09;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: indent with 4 spaces

}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schalkneethling Removed outline: none, 0.5rem => .5rem, spacing fixes, #ffffff => #fff in CSS

.submit {
width: 92%;
margin: 0 auto;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code Style: indent with 4 spaces

}

24 changes: 24 additions & 0 deletions live-examples/html-examples/input/input.html
@@ -0,0 +1,24 @@
<fieldset>
<legend>Input</legend>
<form>
<label for="display-name"> Name:
<span class="warning">*(Allows only alphabets.)</span>
</label>
<input type="text" name="display-name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This element is missing an id attribute with a value that matches the for attribute of the associated label element.

pattern="[A-Za-z\s]+"
maxlength="5" minlength="2" value="Aa" required>
<span class="validity"></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this element being used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schalkneethling This element is being used in CSS to show validation.


<label for="readonly-ip">ReadOnly:</label>
<input type="text" name="readonly-ip"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This element is missing an id attribute with a value that matches the for attribute of the associated label element.

placeholder="I'm read only." readonly />

<label for="disabled-ip">Disabled:</label>
<input type="text"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This element is missing an id attribute with a value that matches the for attribute of the associated label element.

name="disabled-ip"
value="I am disabled"
disabled />
<br/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code style: Do not break between form element with br, instead wrap each label/input group in a div

<input type="submit" class="submit" value="Submit"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Code style: Space before closing />

</form>
</fieldset>
8 changes: 8 additions & 0 deletions live-examples/html-examples/input/meta.json
Expand Up @@ -56,6 +56,14 @@
"title": "HTML Demo: <input type=\"image\">",
"type": "tabbed"
},
"input": {
"baseTmpl": "tmpl/live-tabbed-tmpl.html",
"exampleCode": "live-examples/html-examples/input/input.html",
"cssExampleSrc": "live-examples/html-examples/input/css/input.css",
"fileName": "input-input.html",
"title": "HTML Demo: <input type=\"input\">",
"type": "tabbed"
},
"month": {
"baseTmpl": "tmpl/live-tabbed-tmpl.html",
"exampleCode": "live-examples/html-examples/input/month.html",
Expand Down