UNPKG

access-nyc-patterns

Version:

User Interface Patterns for Benefits Access

241 lines (224 loc) 23.4 kB
<!DOCTYPE html> <html class="bg-color-white text-size-0" lang="en"> <head> <meta charset="utf-8" /> <meta content="IE=edge" http-equiv="X-UA-Compatible" /> <meta content="width=device-width, initial-scale=1" name="viewport" /> <link href="images/apple-icon-57x57.png" rel="apple-touch-icon" sizes="57x57" /> <link href="images/apple-icon-60x60.png" rel="apple-touch-icon" sizes="60x60" /> <link href="images/apple-icon-72x72.png" rel="apple-touch-icon" sizes="72x72" /> <link href="images/apple-icon-76x76.png" rel="apple-touch-icon" sizes="76x76" /> <link href="images/apple-icon-114x114.png" rel="apple-touch-icon" sizes="114x114" /> <link href="images/apple-icon-120x120.png" rel="apple-touch-icon" sizes="120x120" /> <link href="images/apple-icon-144x144.png" rel="apple-touch-icon" sizes="144x144" /> <link href="images/apple-icon-152x152.png" rel="apple-touch-icon" sizes="152x152" /> <link href="images/apple-icon-180x180.png" rel="apple-touch-icon" sizes="180x180" /> <link href="images/android-icon-192x192.png" rel="icon" sizes="192x192" type="image/png" /> <link href="images/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png" /> <link href="images/favicon-96x96.png" rel="icon" sizes="96x96" type="image/png" /> <link href="images/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png" /> <meta content="#112E51" name="msapplication-TileColor" /> <meta content="images/ms-icon-144x144.png" name="msapplication-TileImage" /> <link href="images/favicon.ico" rel="icon" type="image/x-icon" /> <link href="styles/site-default.css" rel="stylesheet" /> <title>Newsletter | ACCESS NYC Patterns</title><noscript> <style> body { visibility: visible !important; } </style> </noscript> <script type="text/javascript"> function load() { document.body.style.visibility = 'visible' }; </script> </head> <body class="bg-color-blue-dark" onload="load()" style="visibility: hidden;"><a class="sr-only" href="#main-content">Skip to main content</a> <div class="bg-color-white"> <header class="color-light-background px-2"> <div class="border-b border-color-grey-light"> <div class="flex items-center justify-between p-2 screen-tablet:py-4 screen-tablet:px-2"> <div> <h1 class="m-0 p-0 leading-normal"><a href="index"><span class="hidden">ACCESS NYC</span><svg aria-hidden="true" class="icon-logo-mark screen-tablet:hidden"> <use xlink:href="#icon-logo-mark"></use> </svg><svg aria-hidden="true" class="icon-logo-full--large text-color-blue-dark hidden screen-tablet:inline-block"> <use xlink:href="#icon-logo-full"></use> </svg></a></h1> </div> <div class="flex items-center"> <h2 class="text-font-size-small m-0 text-color-blue-dark screen-tablet:hidden">Patterns</h2> <h2 aria-hidden="true" class="type-h1 m-0 text-color-blue-dark hidden screen-tablet:inline-block">Patterns</h2> <nav class="text-font-size-small"><a class="rounded-lg text-color-blue-dark border-2 no-underline px-1 ml-2 hidden screen-tablet:inline-block" href="https://github.com/CityOfNewYork/access-nyc-patterns/tree/v0.8.0">0.8.0</a><a aria-hidden="true" class="ml-1 screen-tablet:ml-2 screen-tablet:hidden" href="https://github.com/CityOfNewYork/access-nyc-patterns/tree/v0.8.0">0.8.0</a><button aria-controls="main-menu" aria-expanded="false" class="btn-link ml-1 screen-tablet:ml-2" data-js="toggle" id="main-menu-control">Menu</button></nav> </div> </div> </div> </header> <aside aria-hidden="true" aria-labelledby="main-menu-control" class="color-mid-background text-font-size-small hidden hidden:overflowFadeInUp animated relative" id="main-menu" role="region" style="top: -1px"> <div class="page-wrapper py-4 animated"> <div class="screen-tablet:flex"> <nav class="screen-tablet:flex-1 mb-1 px-2"><a class="type-h3 text-font-size-small mb-1 block screen-tablet:border-b screen-tablet:pb-2 screen-tablet:mb-1 border-color-white p-1" href="index">Home</a><a class="block p-1" href="about">About</a><a class="block p-1" href="installation">Installation</a><a class="block p-1" href="design-tools">Design Tools</a><a class="block p-1 screen-tablet:border-b screen-tablet:pb-2 screen-tablet:mb-1 border-color-white p-1" href="developer-tools">Developer Tools</a><a class="block p-1" href="https://www.npmjs.com/package/access-nyc-patterns">NPM</a><a class="block p-1" href="https://github.com/CityOfNewYork/access-nyc-patterns">GitHub</a></nav> <nav class="screen-tablet:flex-1 mb-1 px-2 screen-desktop:pl-4"><span class="type-h3 text-font-size-small mb-1 block screen-tablet:border-b screen-tablet:pb-2 screen-tablet:mb-1 border-color-white p-1">Elements</span><a class="block p-1" href="buttons">Buttons</a><a class="block p-1" href="checkboxes">Checkboxes</a><a class="block p-1" href="dividers">Dividers</a><a class="block p-1" href="inputs">Inputs</a><a class="block p-1" href="layouts">Layouts</a><a class="block p-1" href="links">Links</a><a class="block p-1" href="lists">Lists</a><a class="block p-1" href="nav">Nav</a><a class="block p-1" href="program-labels">Program Labels</a><a class="block p-1" href="radios">Radios</a><a class="block p-1" href="tables">Tables</a><a class="block p-1" href="tooltips">Tooltips</a><a class="block p-1" href="toggles">Toggles</a><a class="block p-1" href="selects">Selects</a></nav> <nav class="screen-tablet:flex-1 mb-1 px-2 screen-desktop:pl-4"><span class="type-h3 text-font-size-small mb-1 block screen-tablet:border-b screen-tablet:pb-2 screen-tablet:mb-1 border-color-white p-1">Components</span><a class="block p-1" href="accordion">Accordion</a><a class="block p-1" href="alert-box">Alert Box</a><a class="block p-1" href="alert-banner">Alert Banner</a><a class="block p-1" href="card">Card</a><a class="block p-1" href="checklist">Checklist</a><a class="block p-1" href="disclaimer">Disclaimer</a><a class="block p-1" href="filter">Filter</a><a class="block p-1" href="header">Header</a><a class="block p-1" href="member-list">Member List</a><a class="block p-1" href="nearby-stops">Nearby Stops</a><a class="block p-1" href="share-form">Share Form</a><a class="block p-1" href="side-nav">Side Nav</a><a class="block p-1" href="text-controller">Text Controller</a><a class="block p-1" href="question">Question</a></nav> <nav class="screen-tablet:flex-1 mb-1 px-2 screen-desktop:pl-4"><span class="type-h3 text-font-size-small mb-1 block screen-tablet:border-b screen-tablet:pb-2 screen-tablet:mb-1 border-color-white p-1">Objects</span><a class="block p-1" href="announcements">Announcements</a><a class="block p-1" href="banner">Banner</a><a class="block p-1" href="card-list">Card Lists</a><a class="block p-1" href="content">Content</a><a class="block p-1" href="footer">Footer</a><a class="block p-1" href="formstack">Formstack</a><a class="block p-1" href="mobile-nav">Mobile Nav</a><a class="block p-1" href="navigation">Navigation</a><a class="block p-1" href="newsletter">Newsletter</a><a class="block p-1" href="search-box">Search Box</a></nav> <nav class="screen-tablet:flex-1 mb-1 px-2 screen-desktop:pl-4"><a class="type-h3 text-font-size-small mb-1 block screen-tablet:border-b screen-tablet:pb-2 screen-tablet:mb-1 border-color-white p-1" href="utility">Utilities</a><a class="block p-1" href="accessibility">Accessibility</a><a class="block p-1" href="colors">Colors</a><a class="block p-1" href="cookie">Cookie</a><a class="block p-1" href="font">Fonts</a><a class="block p-1" href="icons">Icons</a><a class="block p-1" href="inherit">Inherit</a><a class="block p-1" href="language">Language</a><a class="block p-1" href="media">Media</a><a class="block p-1" href="text">Text</a><a class="block p-1" href="toggle">Toggle</a><a class="block p-1" href="typography">Typography</a></nav> </div> <div class="text-center"><button aria-controls="main-menu" aria-expanded="false" class="btn-link" data-js="toggle">Close Menu</button></div> </div> </aside> <main class="color-light-background pt-4" id="main-content"> <article class="pt-4"> <header class="page-wrapper px-2 screen-desktop:px-0 layout--home-body"> <div class="my-0 w-full"> <h1 class="text-color-blue-dark px-2 pb-4 mb-4">Newsletter</h1> </div> </header> <section class="pb-4 mb-4"> <div class="page-wrapper px-2"> <header class="layout--home-body"> <div class="my-0 px-2 pt-1 pb-4 border-b border-color-grey-light"> <div> <p class="text-font-size-small m-0">Source: <code><a href="https://github.com/CityOfNewYork/access-nyc-patterns/tree/v0.8.0/src/objects/newsletter">src/objects/newsletter/newsletter</a></code></p> </div> </div> </header> <div class="layout--home-body"> <div class="my-0 pt-4 px-2 text-font-size-small table-align-start"><p>The Newsletter Object is an embedded Mailchimp signup form. More details about embedded Mailchimp forms can be found on the <a href="https://mailchimp.com/help/add-a-signup-form-to-your-website/">Mailchimp website</a>. This form can work with any Mailchimp subscriber list that is configured through the form action;</p> <pre><code> form action=&quot;https://nyc.us18.list-manage.com/subscribe/post?u={{ mailchimp account }}&amp;id={{ form id }}&quot; method=&quot;post&quot; id=&quot;mc-embedded-subscribe-form&quot;</code></pre> <p>While the Newsletter Object doesn&#39;t require JavaScript, it is needed for borough data processing (Which borough(s) would you like to recieve updates for?) and front-end validation.</p></div> </div> <div class="layout--gutter screen-tablet:layout--columns justify-between pt-4"> <div class="screen-tablet:pr-2"> <div class="mb-4 p-3 screen-desktop:p-4 bg-color-white" data-js="newsletter"> <div class="type-h3">Get Updates</div> <form action="https://nyc.us18.list-manage.com/subscribe/post?u=d04b7b607bddbd338b416fa89&amp;id=aa67394696" id="mc-embedded-subscribe-form" method="post" novalidate="true" target="_blank"> <div class="c-question"><label class="c-question__label">Receive benefits news and reminders about upcoming open enrollment periods.</label> <div class="c-question__container"><input class="w-full" name="EMAIL" placeholder="Email address" required="true" type="email" /></div> </div> <div class="c-question mt-3"> <fieldset class="c-question"> <legend class="c-question__label">Which borough(s) would you like to recieve updates for?</legend> <div class="c-question__container screen-tablet:layout--columns"><label class="checkbox" data-sketch-symbol-instance="elements/checkboxes/checkboxes" for="mce-group[4369]-4369-0"><input id="mce-group[4369]-4369-0" name="group[4369][1]" type="checkbox" value="1" /><span class="checkbox__label">Bronx</span></label><label class="checkbox" data-sketch-symbol-instance="elements/checkboxes/checkboxes" for="mce-group[4369]-4369-4"><input id="mce-group[4369]-4369-4" name="group[4369][16]" type="checkbox" value="16" /><span class="checkbox__label">Staten Island</span></label><label class="checkbox" data-sketch-symbol-instance="elements/checkboxes/checkboxes" for="mce-group[4369]-4369-3"><input id="mce-group[4369]-4369-3" name="group[4369][8]" type="checkbox" value="8" /><span class="checkbox__label">Queens</span></label><label class="checkbox" data-sketch-symbol-instance="elements/checkboxes/checkboxes" for="mce-group[4369]-4369-1"><input id="mce-group[4369]-4369-1" name="group[4369][2]" type="checkbox" value="2" /><span class="checkbox__label">Brooklyn</span></label><label class="checkbox" data-sketch-symbol-instance="elements/checkboxes/checkboxes" for="mce-group[4369]-4369-2"><input id="mce-group[4369]-4369-2" name="group[4369][4]" type="checkbox" value="4" /><span class="checkbox__label">Manhattan</span></label></div> </fieldset> </div> <div aria-hidden="true" style="position: absolute; left: -5000px;"><input name="b_d04b7b607bddbd338b416fa89_98ff3f3900" tabindex="-1" type="text" value="" /></div><button class="btn-primary btn-small" type="submit">Sign Up</button> <article aria-hidden="true" class="c-alert-box bg-status-warning mt-3 text-font-size-small hidden" data-js-newsletter="alert-box-warning"> <div class="c-alert-box__icon"> <div class="c-alert-box__svg bg-icon-warning"></div> </div> <div class="c-alert-box__body" data-js-newsletter="alert-box__text"></div> </article> <article aria-hidden="true" class="c-alert-box bg-status-success mt-3 text-font-size-small hidden" data-js-newsletter="alert-box-success"> <div class="c-alert-box__icon"> <div class="c-alert-box__svg bg-icon-success"></div> </div> <div class="c-alert-box__body" data-js-newsletter="alert-box__text"></div> </article> </form> </div> </div> <div> <div class="code-block mb-1"><pre>&lt;div class=&quot;mb-4 p-3 screen-desktop:p-4 bg-color-white&quot; data-js=&quot;newsletter&quot; data-sketch-symbol-instance=&quot;elements/checkboxes/checkboxes&quot;&gt; &lt;div class=&quot;type-h3&quot;&gt;Get Updates&lt;/div&gt; &lt;form action=&quot;https://nyc.us18.list-manage.com/subscribe/post?u=d04b7b607bddbd338b416fa89&amp;amp;id=aa67394696&quot; id=&quot;mc-embedded-subscribe-form&quot; method=&quot;post&quot; novalidate=&quot;true&quot; target=&quot;_blank&quot;&gt; &lt;div class=&quot;c-question&quot;&gt;&lt;label class=&quot;c-question__label&quot;&gt;Receive benefits news and reminders about upcoming open enrollment periods.&lt;/label&gt; &lt;div class=&quot;c-question__container&quot;&gt;&lt;input class=&quot;w-full&quot; name=&quot;EMAIL&quot; placeholder=&quot;Email address&quot; required=&quot;true&quot; type=&quot;email&quot; /&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;c-question mt-3&quot;&gt; &lt;fieldset class=&quot;c-question&quot;&gt; &lt;legend class=&quot;c-question__label&quot;&gt;Which borough(s) would you like to recieve updates for?&lt;/legend&gt; &lt;div class=&quot;c-question__container screen-tablet:layout--columns&quot;&gt;&lt;label class=&quot;checkbox&quot; data-sketch-symbol-instance=&quot;elements/checkboxes/checkboxes&quot; for=&quot;mce-group[4369]-4369-0&quot;&gt;&lt;input id=&quot;mce-group[4369]-4369-0&quot; name=&quot;group[4369][1]&quot; type=&quot;checkbox&quot; value=&quot;1&quot; /&gt;&lt;span class=&quot;checkbox__label&quot;&gt;Bronx&lt;/span&gt;&lt;/label&gt;&lt;label class=&quot;checkbox&quot; data-sketch-symbol-instance=&quot;elements/checkboxes/checkboxes&quot; for=&quot;mce-group[4369]-4369-4&quot;&gt;&lt;input id=&quot;mce-group[4369]-4369-4&quot; name=&quot;group[4369][16]&quot; type=&quot;checkbox&quot; value=&quot;16&quot; /&gt;&lt;span class=&quot;checkbox__label&quot;&gt;Staten Island&lt;/span&gt;&lt;/label&gt;&lt;label class=&quot;checkbox&quot; data-sketch-symbol-instance=&quot;elements/checkboxes/checkboxes&quot; for=&quot;mce-group[4369]-4369-3&quot;&gt;&lt;input id=&quot;mce-group[4369]-4369-3&quot; name=&quot;group[4369][8]&quot; type=&quot;checkbox&quot; value=&quot;8&quot; /&gt;&lt;span class=&quot;checkbox__label&quot;&gt;Queens&lt;/span&gt;&lt;/label&gt;&lt;label class=&quot;checkbox&quot; data-sketch-symbol-instance=&quot;elements/checkboxes/checkboxes&quot; for=&quot;mce-group[4369]-4369-1&quot;&gt;&lt;input id=&quot;mce-group[4369]-4369-1&quot; name=&quot;group[4369][2]&quot; type=&quot;checkbox&quot; value=&quot;2&quot; /&gt;&lt;span class=&quot;checkbox__label&quot;&gt;Brooklyn&lt;/span&gt;&lt;/label&gt;&lt;label class=&quot;checkbox&quot; data-sketch-symbol-instance=&quot;elements/checkboxes/checkboxes&quot; for=&quot;mce-group[4369]-4369-2&quot;&gt;&lt;input id=&quot;mce-group[4369]-4369-2&quot; name=&quot;group[4369][4]&quot; type=&quot;checkbox&quot; value=&quot;4&quot; /&gt;&lt;span class=&quot;checkbox__label&quot;&gt;Manhattan&lt;/span&gt;&lt;/label&gt;&lt;/div&gt; &lt;/fieldset&gt; &lt;/div&gt; &lt;div aria-hidden=&quot;true&quot; style=&quot;position: absolute; left: -5000px;&quot;&gt;&lt;input name=&quot;b_d04b7b607bddbd338b416fa89_98ff3f3900&quot; tabindex=&quot;-1&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;&lt;/div&gt;&lt;button class=&quot;btn-primary btn-small&quot; type=&quot;submit&quot;&gt;Sign Up&lt;/button&gt; &lt;article aria-hidden=&quot;true&quot; class=&quot;c-alert-box bg-status-warning mt-3 text-font-size-small hidden&quot; data-js-newsletter=&quot;alert-box-warning&quot;&gt; &lt;div class=&quot;c-alert-box__icon&quot;&gt; &lt;div class=&quot;c-alert-box__svg bg-icon-warning&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;c-alert-box__body&quot; data-js-newsletter=&quot;alert-box__text&quot;&gt;&lt;/div&gt; &lt;/article&gt; &lt;article aria-hidden=&quot;true&quot; class=&quot;c-alert-box bg-status-success mt-3 text-font-size-small hidden&quot; data-js-newsletter=&quot;alert-box-success&quot;&gt; &lt;div class=&quot;c-alert-box__icon&quot;&gt; &lt;div class=&quot;c-alert-box__svg bg-icon-success&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;c-alert-box__body&quot; data-js-newsletter=&quot;alert-box__text&quot;&gt;&lt;/div&gt; &lt;/article&gt; &lt;/form&gt; &lt;/div&gt;</pre> </div> </div> </div> </div> </section> <section class="pb-4 mb-4" id="newsletter-usage"> <div class="page-wrapper px-2 screen-desktop:px-0"> <header class="layout--home-body"> <div class="my-0 px-2 border-b border-color-grey-light screen-tablet:flex screen-tablet:justify-between"> <h2 class="m-0 pt-1 pb-4"><a class="text-color-grey-mid font-normal no-underline capitalize" href="#newsletter-usage">Newsletter Usage</a></h2> </div> </header> <div class="layout--home-body"> <div class="my-0 pt-4 px-2 text-font-size-small table-align-start"><h4>Global Script</h4> <p>The Newsletter Object does not require JavaScript, however, the associated script provides front-end validation and borough data processing. To use the Newsletter in the global ACCESS NYC Patterns script use the following code:</p> <pre><code>var access = new AccessNyc(); var newsletter = access.newsletter();</code></pre> <p>This function will attach the Newsletter submission event and borough data processing to the body of the document.</p> <h5>Providing Strings</h5> <p>The list of strings below are used for validation and alert messaging. They can be overridden using the <code>.strings</code> method and passing an object of new strings. Dynamic variables are passed to the strings (denoted by <code>{{ }}</code> below) is provided and rendered in the output of the string. This method can be used to provide a localized set of strings.</p> <pre><code>newsletter.strings({ VALID_REQUIRED: &#39;This field is required.&#39;, VALID_EMAIL_REQUIRED: &#39;Email is required.&#39;, VALID_EMAIL_INVALID: &#39;Please enter a valid email.&#39;, VALID_CHECKBOX_BOROUGH: &#39;Please select a borough.&#39;, ERR_PLEASE_TRY_LATER: &#39;There was an error with your submission. Please try again later.&#39;, SUCCESS_CONFIRM_EMAIL: &#39;Almost finished... We need to confirm your email address. To complete the subscription process, please click the link in the email we just sent you.&#39;, ERR_PLEASE_ENTER_VALUE: &#39;Please enter a value&#39;, ERR_TOO_MANY_RECENT: &#39;Recipient &quot;{{ EMAIL }}&quot; has too many recent signup requests&#39;, ERR_ALREADY_SUBSCRIBED: &#39;{{ EMAIL }} is already subscribed to list {{ LIST_NAME }}.&#39;, ERR_INVALID_EMAIL: &#39;This email address looks fake or invalid. Please enter a real email address.&#39;, LIST_NAME: &#39;ACCESS NYC - Newsletter&#39; });</code></pre> <h4>Module Import</h4> <p>The ES6 and CommonJS modules require importing and object instantiation in your main script. The methods and configurations described above will work with the dedicated module.</p> <pre><code>import Newsletter from &#39;../objects/newsletter/newsletter&#39;; let element = document.querySelector(Newsletter.selector); if (element) new Newsletter(element);</code></pre> <p>The component requires the <code>data-js=&quot;newsletter&quot;</code> attribute and a unique ID targeting the form body.</p></div> </div> </div> </section> <div class="sticky bottom-0 bg-color-white shadow-up relative z-10 overflow-y-scroll whitespace-no-wrap animated fadeInUp"> <nav class="nav-inline text-font-size-small p-4"><span class="mr-4">Jump to:</span><a class="mr-4" href="#newsletter-usage">Newsletter Usage</a></nav> </div> </article> </main> </div> <footer class="py-4 text-center color-dark-background"> <p> <nav><a class="px-1" href="index">Home</a><a class="px-1" href="about">About</a><a class="px-1" href="installation">Installation</a><a class="px-1" href="design-tools">Design Tools</a><a class="px-1" href="developer-tools">Developer Tools</a></nav> </p> <p>Maintained by&nbsp;<a href="https://nyc.gov/opportunity">NYC Opportunity</a></p> <p class="m-0"> <nav><a class="px-1" href="https://github.com/orgs/CityOfNewYork/teams/nycopportunity">GitHub</a><a class="px-1" href="https://twitter.com/nycopportunity">Twitter</a><a class="px-1" href="https://www.facebook.com/NYCOpportunity">Facebook</a><a class="px-1" href="https://www.instagram.com/nycopportunity">Instagram</a></nav> </p> </footer> <script src="scripts/polyfills.js"></script> <script src="scripts/access-nyc.js"></script> <script src="scripts/vue-components.js"></script> <script type="text/javascript"> var access = new AccessNyc(); var VueComponents = new VueComponents(); access.icons(); access.toggle(); access.alertBanner(); </script> <script type="text/javascript"> var newsletter = access.newsletter(); newsletter.strings({ VALID_EMAIL_INVALID: 'Please enter a valid email with "@".', SUCCESS_CONFIRM_EMAIL: 'Success! To complete the subscription process, please click the link in the email we just sent you.', }); </script> </body> </html>