-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
⚠️ 📖 DRAFT: <tag-complete> #117
Open
snuggs
wants to merge
13
commits into
main
Choose a base branch
from
examples/email-recipients
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6833d8b
Specifications for `email-recipient`
snuggs 504008b
Fix broken stylesheet
snuggs 5332444
Convert input to type search
snuggs 80108c4
Fix formatting of templates
snuggs f783911
Add spaces between color values as per @brandondees request
snuggs d2859d3
Add comment on fallback input type=checkbox usage
snuggs bcebf26
Migrate contacts to initialize
snuggs cd2e718
Refactor to Tsu patterns
snuggs d2df475
Add reference to react typeahead
snuggs 653a03d
Remove box-shadow from address
snuggs 4987974
Change comma sizing after address
snuggs 98bebf6
Lighten background color for address
snuggs a08ecf6
Add magin to address search input
snuggs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,91 @@ | ||
<title><email></title> | ||
|
||
<link rel=stylesheet href=style.css> | ||
|
||
<email-recipients> | ||
|
||
<template name=recipients> | ||
<address> | ||
<button id={#} | ||
onclick=onremove | ||
title='Remove <{self}> from recipients'>x</button> | ||
|
||
<label> | ||
<!-- `recipients` values when used within `<form>` --> | ||
<input name=recipients[] type=checkbox value={self} checked> | ||
{self} | ||
</label> | ||
</address> | ||
</template> | ||
|
||
<input | ||
type=search | ||
name=address | ||
list=contacts | ||
onchange=addrecipient | ||
[email protected]> | ||
|
||
<datalist id=contacts> | ||
<template name=contacts> | ||
<option value={email}>{name} <{email}> | ||
</template> | ||
</datalist> | ||
|
||
</email-recipients> | ||
|
||
<footer> | ||
<header>Comparable Examples</header> | ||
|
||
<ul> | ||
<li> | ||
<a href=https://github.com/ericgio/react-bootstrap-typeahead>React Typeahead</a> | ||
</footer> | ||
|
||
<script src=/snuggsi.es></script> | ||
<script defer> | ||
|
||
Element `email-recipients` | ||
|
||
(class extends HTMLElement { | ||
|
||
initialize () { | ||
this.context.recipients = | ||
['[email protected]', '[email protected]'] | ||
|
||
this.context.contacts = [ | ||
{ name: 'Tim', email: '[email protected]' }, | ||
{ name: 'Rob Cole', email: '[email protected]' } | ||
] | ||
} | ||
|
||
// use Array.prototype.splice | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice | ||
onremove (event, id = event.target.id) { | ||
this.context.recipients | ||
.splice (id, 1) | ||
|
||
this.select | ||
`input[name=address]`.focus () | ||
} | ||
|
||
addrecipient (event, input = event.target) { | ||
this.context.recipients | ||
.push (input.value) | ||
|
||
input.value = '' | ||
} | ||
|
||
get recipients () | ||
{ return this.context.recipients } | ||
|
||
get contacts () | ||
{ return this.context.contacts } | ||
}) | ||
|
||
</script> | ||
|
||
<script src=/browser-sync.es></script> | ||
<script | ||
name=polyfill | ||
src=//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.0.0/webcomponents-hi-ce.js> | ||
</script> |
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,70 @@ | ||
:root { | ||
--email-recipients-corner-radius: 1vw; | ||
} | ||
|
||
email-recipients, | ||
email-recipients | ||
> address:hover | ||
{ border-radius: var(--email-recipients-corner-radius) } | ||
|
||
email-recipients { | ||
padding: 1em; | ||
display: flex; | ||
flex-basis: auto; | ||
flex-flow: row wrap; | ||
box-shadow: 0 0 0.28em rgba(40, 40, 40, 0.8) | ||
} | ||
|
||
email-recipients > * { | ||
font-size: 90%; | ||
line-height: 1.612em; | ||
} | ||
|
||
email-recipients > address { | ||
display: flex; | ||
cursor: pointer; | ||
margin: 0; | ||
font-style: normal; | ||
align-items: center; | ||
flex-flow: row nowrap; | ||
font-family: sans-serif; | ||
} | ||
email-recipients > address::after { | ||
content: ", "; | ||
font-size: 1.6em; | ||
font-weight: 300; | ||
margin-top: -0.3em; | ||
color: rgba(50, 50, 50, 0.7); | ||
} | ||
email-recipients > address:hover { | ||
background: rgba(220, 220, 220, 0.5) | ||
} | ||
email-recipients > address button { | ||
opacity: 0; | ||
border: none; | ||
background: none; | ||
margin-right: 0.12em; | ||
padding: 0 0.12em 0 0.2em; | ||
border-right: 1px solid red; | ||
} | ||
|
||
email-recipients > address:hover button { | ||
opacity: 0.5; | ||
font-size: 80%; | ||
cursor: pointer; | ||
color: rgba(230, 0, 0, 0.9) | ||
} | ||
email-recipients > address button:hover { | ||
opacity: 1.0 | ||
} | ||
|
||
email-recipients input[name='recipients[]'] { | ||
display: none; | ||
} | ||
email-recipients input[name=address] { | ||
flex: 0; | ||
border: none; | ||
outline: none; | ||
line-height: 1em; | ||
margin-left: 0.7em; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we load this conditionally based on localhost?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandondees we do already ;-) https://github.com/devpunks/snuggsi/blob/master/snippets/browser-sync.es#L3-L7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, hadn't picked up on that. well played.