From 09c1d2ae3cec8745ba5dbe6bf67c7df06c25f0cf Mon Sep 17 00:00:00 2001
From: BRIAN MUENZENMEYER
Further reading: Optimizing Web Experiences for High Resolution Screens
" + }, + { + "el": "#nav", + "title" : "Navigation", + "comment": "Navigation for adaptive web experiences can be tricky. Top navigations are typical on desktop sites, but mobile screen sizes don't give us the luxury of space. We're dealing with this situation by creating a simple menu anchor that toggles the main navigation on small screens. This is just one method. Bagcheck and Contents Magazine add an anchor in the header that jumps users to the navigation which is placed in the footer. This solution works well because it doesn't require any Javascript in order to work. Other methods exist too. For example, ESPN's mobile navigation overlays the main content of the page.
The nav is only hidden when a certain level of javascript is supported in order to ensure that users with little/poor javascript support can still access the navigation. Once the screen size is large enough to accommodate the nav, we show the main navigation links and hide the menu anchor.
See also: Responsive Navigation Patterns
" + }, + { + "el": "input[type=search]", + "title" : "Search", + "comment": "Search is an incredibly important priority, especially for mobile. It is a great idea to give users the ability to jump directly to what they are looking for without forcing them to wade through your site's navigation. Check out the Burton and Yelp mobile sites for great examples of experiences that prioritize search.
We're also using the HTML5 search input type, which is great for mobile devices that can bring up the appropriate virtual keyboard for many smartphones. And like the main header navigation, we're hiding the search form on small screens to save space. Clicking the search anchor toggles the form.
" + }, + { + "el": "#product-img nav", + "title" : "Image Navigation", + "comment": "Instead of providing bullets, pagination or text-based image navigation, it's good e-commerce practice to show a preview of the various product views. By default the images simply link through to their larger counterparts, and if adequate javascript support exists, the images get loaded into the main image container.
" + }, + { + "el": "#img-container", + "title" : "Product Image", + "comment": "The product image is the focal point of the page for good reason. It's typically what the user is there to see. The default markup simply includes the main product image, but that gets replaced with an image gallery if adequate javascript support exists.
We're also using Modernizr to detect if the browser supports touch events and if it does, we load in an excellent lightweight script called Swipe.js to create a touch-friendly image carousel. This allows users to swipe between product photos in a touch-friendly way. Because gestures are invisible, they might get overlooked, but clicking on the image navigation thumbnails animates the slideshow and hints to the user gestural interaction is available.
" + }, + { + "el": ".product-main header", + "title" : "Product Overview", + "comment": "The product overview appears in the markup before the image container in order to provide the user with the product name, how much it costs and how popular it is. Providing this information as soon as possible can help the user determine whether or not this is the product they're looking for without having to wait for the rest of the page to load." + }, + { + "el": ".star", + "title" : "Rating Stars", + "comment": "We're using HTML special characters to display the product rating stars. We're using HTML characters instead of images to reduce the amount of images we're requesting and also maintaining crispness on high resolution screens. Not every device supports HTML special characters (Blackberry <=5.0 for example), but support is strong enough and the benefits are many.
See also: Optimizing Web Experiences for High Resolution Screens
" + }, + { + "el": ".review-count", + "title" : "Review Count", + "comment": "This is a simple anchor link that points to the review section of the page. This may seem like a small detail, but consider a mobile use case. Users can be in stores looking at the physical product, and 79% of smartphone consumers use their phones to help with shopping. They might be interested in buying in-store but turn to their phones to verify its popularity and quality. Making it easy for uses to read product reviews on small screens can help drive more sales, both online and offline.While not incorporated yet, it would be easy to load the reviews for small screens on demand, thereby saving a step.
" + }, + { + "el": ".qty-field", + "title" : "Quantity Field", + "comment": "We're using the HTML5 number input type, which brings up the appropriate virtual keyboard for many mobile browsers. To increase usability, the input labels are using the \"for\" attribute, which focuses the cursor in the form field when clicked. However, iOS doesn't honor \"for\" default functionality, so we're adding \"cursor: pointer\" to the labels to get Mobile Safari to behave properly." + }, + { + "el": ".size-field", + "title" : "Size Dropdown", + "comment": "We're using a basic select menu to choose the size, which is commonplace for any e-commerce site. Select menus can be especially difficult to style and can vary greatly in behavior between platforms. Keep this in mind when creating " + }, + { + "el": ".submit-form", + "title" : "Add to Cart button", + "comment": "The add to cart button is the primary user action on the page. That's why it's large and in charge and very prominently placed on the page. The button is using box-shadows and rounded corners to create an attractive button that will hopefully get plenty of clicks." + }, + { + "el": ".share-btn", + "title" : "Share button", + "comment": "It seems like everything has a share button on it these days. And for good reason. Sharing content and products on social networks can be a great way to increase exposure. However, tacking on tons of social widgets adds a lot of overhead, which can be extremely detrimental to the site's performance. Including a simple share link that loads the heavy widgets only when requested is one way to keep pages fast and social. Check out Target's mobile site for an example of a site that isolates share functionality in a separate page fragment." + }, + { + "el": ".find-nearby", + "title" : "Geolocation", + "comment": "One of the most important aspects of the mobile context is location. We carry our mobile devices with us everywhere. Using geolocation we can tap into the user's location to deliver an enhanced experience. In this case we're giving them a chance to check out what stores nearby might sell this product. The geolocation API is well supported in mobile browsers as well as desktop browsers. We're using Modernizr to detect for geolocation support and if its support, we ask the user for their latitude and longitude. If the browser does not support geolocation, the default experience could take the user to a simple web form asking for a ZIP code. Check out Tiffany's mobile site store locator for an example of geolocation in action." + }, + { + "el": "#p-desc", + "title" : "Product Description", + "comment": "A product description is an essential part of any e-commerce experience. Descriptions offer tangible details that inform and persuade, and the tone can help support the physical product. Provide relevant information clearly and concisely. Check out the Android design guide for some tips on how to keep copy short and extremely effective." + }, + { + "el": "#related-products", + "title" : "Related Products", + "comment": "Related products are obviously an important aspect of e-commerce sites as they drive awareness of other similar products and can lead to more purchases. However, including a lot of auxiliary content can bog down the site performance, which is especially crucial on mobile. On slow connections, the presence of this extra content might slow down the user experience enough that the user gives up.
We're handling the issue by conditionally loading the auxiliary content.
By default, the related item link simply clicks through to an HTML fragment containing the related products. The content is still accessible, even on devices with poor or no javascript support. When the user clicks on the related products on small screens, the content gets dynamically loaded inline and the link becomes a toggler for the content. Once the experience reaches a certain width breakpoint, we then load in the content. However, screen size != fast connection, so we should keep our eyes on the emerging navigator.connection to better gauge real connection speed.
See also: An Ajax-Include Pattern for Modular Content
All these wonderful t-shirts are retired/rejected Busted Tees, graciously donated to this demo by Will Schneider.
" + }, + { + "el": "#reviews", + "title" : "Reviews", + "comment": "Reviews are incredibly influential on a user's decision to purchase a product or pass on it. Also, because we carry our mobile phones with us everywhere, we use them to inform our in-store purchased. 70% of smartphone owners use them while in brick and mortar stores, and often times they're looking for reviews to give them the green light to buy.Only the primary product content gets loaded by default, and the reviews exist as their own separate HTML fragment. The reviews remain accessible and don't get loaded until we conditionally load them when the screen is large enough or small screen users click the reviews link. This keeps things nimble while still providing access to the valuable reviews.
See also: An Ajax-Include Pattern for Modular Content
" + }, + { + "el": "#p-reviews .btn", + "title" : "More Reviews Button", + "comment": "All reviews aren't loaded by default in order to keep the site performance in top shape. Ultimately, this button could be replaced with a lazy-loading solution to remove the need for the button.
" + }, + { + "el": ".footer .nav", + "title" : "Footer Nav", + "comment": "Repetition of elements isn't a bad thing, especially with potentially long scrolling pages on mobile. Providing access to the main site navigation is a good way for the user to jump off to another section and avoids leaving them with a dead end. Also, some mobile sites like Bagcheck and Contents Magazine keep the primary navigation at the footer and simply link to it with an anchor in the header. That way the nav stays accessible but the focus stays on on the core page content.
" + }, + { + "el": ".tel", + "title" : "Customer Service Number", + "comment": "We sometimes forget that mobile phones can make phone calls. Whether a user is having trouble with the site or simply has some questions about the product he's about to buy, it's a smart decision to provide a clickable phone number to facilitate that call. What happens when desktops and other non-phone devices click on the tel link? Well, some devices (like iPads and other tablets) ask the user if they'd like to add the number to their contact list, other desktops open 3rd party VoIP programs like Skype, and others simply give an error message.
" + }, + { + "el": ".top", + "title" : "Back to Top Link", + "comment": "Back to top links are simple yet underrated. They provide users with an easy way back up to the top of the page with minimum effort. This is especially helpful on mobile devices, which tend to have long scrolling pages.
We're using an HTML character for the back to top arrow in order to reduce image elements and keep things looking crisp on high res displays.
" + } +] +}; \ No newline at end of file diff --git a/public/styleguide/css/prism.css b/public/styleguide/css/prism.css new file mode 100644 index 000000000..0b78bd0c4 --- /dev/null +++ b/public/styleguide/css/prism.css @@ -0,0 +1,112 @@ +/** + * okaidia theme for JavaScript, CSS and HTML + * Loosely based on Monokai textmate theme by http://www.monokai.nl/ + * @author ocodia + */ + +code[class*="language-"], +pre[class*="language-"] { + color: #f8f8f2; + text-shadow: 0 1px rgba(0,0,0,0.3); + font-family: Consolas, Monaco, 'Andale Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + border-radius: 0.3em; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #272822; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #f8f8f2; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.constant, +.token.symbol { + color: #f92672; +} + +.token.boolean, +.token.number{ + color: #ae81ff; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.builtin { + color: #a6e22e; +} + + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string, +.token.variable { + color: #f8f8f2; +} + +.token.atrule, +.token.attr-value +{ + color: #e6db74; +} + + +.token.keyword{ +color: #66d9ef; +} + +.token.regex, +.token.important { + color: #fd971f; +} + +.token.important { + font-weight: bold; +} + +.token.entity { + cursor: help; +} diff --git a/public/styleguide/css/static.css b/public/styleguide/css/static.css index 4eaaca793..e69de29bb 100644 --- a/public/styleguide/css/static.css +++ b/public/styleguide/css/static.css @@ -1,401 +0,0 @@ -@charset "UTF-8"; -/* -colors -red: $orange; rgb(229,24,55) -gray: #808080; -*/ -/************Reset**************/ -* { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -html, body, div, object, iframe, fieldset { - margin: 0; - padding: 0; - border: 0; -} - -ol, ul { - list-style: none; - margin: 0; - padding: 0; -} - -table { - border-collapse: collapse; - border-spacing: 0; -} - -header, footer, nav, section, article, hgroup, figure { - display: block; -} - -legend { - display: none; -} - -/************End Reset**************/ -/************Global**************/ -body { - background: #fff; - color: #000; - font: 100%/1.4 "HelveticaNeue", "Helvetica", "Arial", sans-serif; - padding: 0; - -webkit-text-size-adjust: 100%; - border-top: 20px solid black; - border-bottom: 20px solid black; -} - -a { - color: #808080; - text-decoration: none; -} - -a:hover, a:focus { - color: #bededf; -} - -p { - margin: 0 0 1em; -} - -img, object, video { - max-width: 100%; - border: 0; -} - -a img { - border: 0; - outline: 0; -} - -h1 { - font-size: 3em; - line-height: 1; - letter-spacing: -0.02em; - margin-bottom: 0.2em; -} - -h2 { - font-size: 2em; - line-height: 1.1; - margin-bottom: 0.2em; -} - -h3 { - font-weight: normal; - line-height: 1.1; - padding-bottom: 0.4em; - border-bottom: 1px solid #cccccc; -} - -h1 a, h2 a, h3 a { - display: block; - color: #000; -} - -h1 a:hover, h2 a:hover, h3 a:hover { - color: #bededf; -} - -blockquote { - border-left: 0.5em solid #dddddd; - padding-left: 1em; - margin-left: 1em; -} - -small { - color: #bededf; -} - -input[type=search] { - -webkit-appearance: none; - border-radius: 0; -} - -::-webkit-input-placeholder { - color: #808080; -} - -:-moz-placeholder { - color: #808080; -} - -/************End Global**************/ -/************Classes**************/ -.inactive { - color: #ddd; -} - -/************End Classes**************/ -/************Structure**************/ -.container { - max-width: 60em; - margin: 0 auto; - padding: 0 1em; - overflow: hidden; -} - -[role=main] { - padding-bottom: 1em; -} - -/*Footer*/ -[role=contentinfo] { - color: #fff; - background: #000; - margin: 0 -1em; - position: relative; - z-index: 2; - /*End Footer*/ - /*Grid*/ - /*Fluid*/ - /*Homepage*/ - /*Patterns*/ - /*Blog*/ - /*Blog Header*/ - /*Posts*/ - /* Sidebar */ -} -[role=contentinfo] > div { - max-width: 60em; - padding: 0 1em; - margin: 0 auto; - overflow: hidden; -} -[role=contentinfo] .grid { - margin: 0 -1em; - overflow: hidden; -} -[role=contentinfo] .grid:target { - -webkit-animation: fadeout 5s 1 ease-out; - -moz-animation: fadeout 5s 1 ease-out; - -o-animation: fadeout 5s 1 ease-out; - animation: fadeout 5s 1 ease-out; -} -[role=contentinfo] .grid > h2 { - margin-left: 0.45em; -} -[role=contentinfo] .grid > section { - padding: 1em 1em 0.5em; -} -[role=contentinfo] .grid > section:target { - -webkit-animation: fadeout 5s 1 ease-out; - -moz-animation: fadeout 5s 1 ease-out; - -o-animation: fadeout 5s 1 ease-out; - animation: fadeout 5s 1 ease-out; -} -[role=contentinfo] .grid ul { - overflow: hidden; -} -[role=contentinfo] .grid ul li { - margin-bottom: 0.3em; -} -[role=contentinfo] .featured:after { - content: "*"; - color: #bededf; -} -[role=contentinfo] .fluid { - display: block; - margin: 0 auto; - max-width: 40em; -} -[role=contentinfo] .home h1 { - margin-bottom: 0.2em; -} -[role=contentinfo] .intro { - font-size: 1.8em; - line-height: 1.2; - margin: 0 auto; -} -[role=contentinfo] .intro a:hover, [role=contentinfo] .intro a:focus { - color: #000; - border-bottom-color: #000; -} -[role=contentinfo] .ani { - position: relative; - height: 15em; - margin: 1em 0 0; - width: 100%; - z-index: 0; -} -[role=contentinfo] .ani div { - width: 100%; -} -[role=contentinfo] .ani div b { - display: block; - position: absolute; - top: 5%; - right: 5%; - bottom: 5%; - left: 5%; - background: rgba(229, 24, 55, 0.22); -} -[role=contentinfo] .mod { - padding: 1em; -} -[role=contentinfo] .pattern { - background: #f7f7f7; - border-bottom: 1px solid gray; - margin-bottom: 1em; - overflow: hidden; -} -[role=contentinfo] .pattern-description h1 { - font-size: 3.4em; - margin-bottom: 0.5em; -} -[role=contentinfo] .pattern-description { - max-width: 40em; - margin: 0 auto; -} -[role=contentinfo] .pattern-description ul, [role=contentinfo] .pattern-description ol { - margin-bottom: 2em; -} -[role=contentinfo] .pattern-description li { - margin-bottom: 1em; -} -[role=contentinfo] .blog .container { - max-width: 62em; -} -[role=contentinfo] .blog header[role=banner] { - overflow: hidden; - margin-bottom: 2em; - padding: 2em 0 1em; - border-bottom: 1px solid black; -} -[role=contentinfo] .blog-logo { - font-weight: normal; - font-size: 1.2em; - margin: 0 0 1em; -} -[role=contentinfo] .blog-logo img { - width: 3.3em; -} -[role=contentinfo] .blog-logo a { - color: #000; -} -[role=contentinfo] .search-form { - width: 100%; - margin-bottom: 1em; -} -[role=contentinfo] .search-field { - width: 100%; - padding: 0.5em 0; - border: 0; - border-bottom: 1px solid gray; - outline: none; -} -[role=contentinfo] .search-field:focus { - background: #bededf; - color: #fff; -} -[role=contentinfo] .search-field:focus::-webkit-input-placeholder { - color: #fff; -} -[role=contentinfo] .search-field:focus :-moz-placeholder { - color: #fff; -} -[role=contentinfo] .blog .nav { - clear: both; -} -[role=contentinfo] .blog .nav a { - display: block; - font-weight: bold; - color: #000; -} -[role=contentinfo] .blog .nav a:hover { - color: #bededf; -} -[role=contentinfo] .posts ol > li { - padding-bottom: 1em; - border-bottom: 1px solid #cccccc; - margin-bottom: 1em; - overflow: hidden; -} -[role=contentinfo] .posts h2 { - font-size: 1.4em; - margin: 0.28em 0 0.1em; - font-weight: normal; -} -[role=contentinfo] .posts h2 a { - color: #000; -} -[role=contentinfo] .posts h2 a:hover, [role=contentinfo] .posts h2 a:focus { - color: #bededf; -} -[role=contentinfo] .permalink { - display: block; - font-size: 0.8em; - margin-bottom: 1.2em; -} -[role=contentinfo] .post-body a { - border-bottom: 1px solid #cccccc; -} -[role=contentinfo] .posts blockquote { - margin: 0 0 1em; - color: #666; - border-left: 0.25em solid #cccccc; - padding-left: 1em; -} -[role=contentinfo] .tags { - float: left; -} -[role=contentinfo] .tags li { - display: inline-block; - font-size: 0.8em; - margin-right: 0.5em; -} -[role=contentinfo] .posts ol > li .tags a, [role=contentinfo] .permalink { - color: #ccc; - -webkit-transition: color 0.3s ease-out; - -moz-transition: color 0.3s ease-out; - -ms-transition: color 0.3s ease-out; - -o-transition: color 0.3s ease-out; - transition: color 0.3s ease-out; -} -[role=contentinfo] .posts ol > li:hover .tags a, [role=contentinfo] .posts ol > li:hover .permalink { - color: #808080; -} -[role=contentinfo] .blog-nav { - text-align: center; - overflow: hidden; - padding: 1em 0; -} -[role=contentinfo] .posts .blog-nav a { - border: 0; -} -[role=contentinfo] .nav-next { - float: right; -} -[role=contentinfo] .nav-prev { - float: left; -} -[role=contentinfo] .sidebar { - font-size: 0.8em; - padding-bottom: 1.4em; -} -[role=contentinfo] .sidebar div { - margin-bottom: 2em; -} -[role=contentinfo] .sidebar h3 { - font-weight: bold; - font-size: 0.9em; - line-height: 1; - border-bottom: 1px solid black; -} -[role=contentinfo] .sidebar a { - color: #808080; -} -[role=contentinfo] .sidebar a:hover, [role=contentinfo] .sidebar a:focus { - color: #bededf; -} -[role=contentinfo] .top { - clear: both; - display: block; - padding: 1em 0; -} -[role=contentinfo] .top:before { - content: '▲'; -} diff --git a/public/styleguide/css/static.scss b/public/styleguide/css/static.scss index 4a34269cb..a22d5d744 100644 --- a/public/styleguide/css/static.scss +++ b/public/styleguide/css/static.scss @@ -1,4 +1,3 @@ -@charset "UTF-8"; /* colors red: $orange; rgb(229,24,55) @@ -140,6 +139,7 @@ input[type=search] { padding: 0 1em; margin: 0 auto; overflow: hidden; + } } /*End Footer*/ @@ -401,4 +401,4 @@ input[type=search] { .top:before { content: '▲'; } -} \ No newline at end of file + diff --git a/public/styleguide/css/styleguide.css b/public/styleguide/css/styleguide.css index e320709a4..40ec4a27f 100644 --- a/public/styleguide/css/styleguide.css +++ b/public/styleguide/css/styleguide.css @@ -1,6 +1,6 @@ /*------------------------------------*\ - $STYLE GUIDE CONTAINER STYLES - \*------------------------------------*/ + $STYLE GUIDE CONTAINER STYLES +\*------------------------------------*/ /** * NOTE: These styles are specific to the style guide container and should not be modified. * Use style.scss for all content styles that don't pertain to the style guide container. @@ -8,8 +8,8 @@ * Second note: Any important declarations are to prevent brand styles from overriding style guide */ /*------------------------------------*\ - $CONTENTS - \*------------------------------------*/ + $CONTENTS +\*------------------------------------*/ /** * STYLE GUIDE VARIABLES------------------Declarations of Sass variables * -----Font @@ -35,8 +35,8 @@ * -----Code View */ /*------------------------------------*\ - $STYLE GUIDE VARIABLES - \*------------------------------------*/ + $STYLE GUIDE VARIABLES +\*------------------------------------*/ /*Fonts*/ /* Style Guide Interface Colors */ /* Typography */ @@ -44,26 +44,20 @@ /* Dimensions */ /* Breakpoints */ /*------------------------------------*\ - $STYLE GUIDE MIXINS - \*------------------------------------*/ + $STYLE GUIDE MIXINS +\*------------------------------------*/ /*------------------------------------*\ - $STYLE GUIDE INTERFACE - \*------------------------------------*/ -html, body { + $STYLE GUIDE INTERFACE +\*------------------------------------*/ +#patternlab-html, #patternlab-body { margin: 0; padding: 0; background: #dddddd; - -webkit-text-size-adjust: 100%; -} - -html#pattern-frame { - background: #fff; -} + -webkit-text-size-adjust: 100%; } .sg-nav-wrapper { overflow: hidden; - background: #dddddd; -} + background: #dddddd; } .is-vishidden { position: absolute !important; @@ -72,11 +66,10 @@ html#pattern-frame { height: 1px; padding: 0; border: 0; - clip: rect(1px, 1px, 1px, 1px); -} + clip: rect(1px, 1px, 1px, 1px); } /*------------------------------------*\ -$STYLE GUIDE HEADER + $STYLE GUIDE HEADER \*------------------------------------*/ /* Header */ .sg-header { @@ -91,60 +84,50 @@ $STYLE GUIDE HEADER width: 100%; -webkit-box-shadow: inset 0 1px 0 #5f6164, inset 0 -1px 0 #2e2f2f, 0 1px 3px rgba(0, 0, 0, 0.3); -moz-box-shadow: inset 0 1px 0 #5f6164, inset 0 -1px 0 #2e2f2f, 0 1px 3px rgba(0, 0, 0, 0.3); - box-shadow: inset 0 1px 0 #5f6164, inset 0 -1px 0 #2e2f2f, 0 1px 3px rgba(0, 0, 0, 0.3); -} -.sg-header * { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} -.sg-header ul, .sg-header ol { - padding: 0; - margin: 0; -} -.sg-header li { - list-style: none; - border-bottom: 1px solid rgba(255, 255, 255, 0.05); -} -.sg-header a { - font-size: 70%; - color: gray; - text-decoration: none; - display: block; - line-height: 1; - padding: 1em; - -webkit-transition: background 0.15s ease-out; - -moz-transition: background 0.15s ease-out; - -ms-transition: background 0.15s ease-out; - -o-transition: background 0.15s ease-out; - transition: background 0.15s ease-out; - -webkit-transition: color 0.15s ease-out; - -moz-transition: color 0.15s ease-out; - -ms-transition: color 0.15s ease-out; - -o-transition: color 0.15s ease-out; - transition: color 0.15s ease-out; -} -.sg-header a:hover, .sg-header a:focus, .sg-header a.active { - color: white; - background: rgba(255, 255, 255, 0.05); -} -.sg-header ol li ol li ol li a { - padding-left: 2em; - text-transform: capitalize; -} + box-shadow: inset 0 1px 0 #5f6164, inset 0 -1px 0 #2e2f2f, 0 1px 3px rgba(0, 0, 0, 0.3); } + .sg-header * { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; } + .sg-header ul, .sg-header ol { + padding: 0; + margin: 0; } + .sg-header li { + list-style: none; + border-bottom: 1px solid rgba(255, 255, 255, 0.05); } + .sg-header a { + font-size: 70%; + color: gray; + text-decoration: none; + display: block; + line-height: 1; + padding: 1em; + -webkit-transition: background 0.15s ease-out; + -moz-transition: background 0.15s ease-out; + -ms-transition: background 0.15s ease-out; + -o-transition: background 0.15s ease-out; + transition: background 0.15s ease-out; + -webkit-transition: color 0.15s ease-out; + -moz-transition: color 0.15s ease-out; + -ms-transition: color 0.15s ease-out; + -o-transition: color 0.15s ease-out; + transition: color 0.15s ease-out; } + .sg-header a:hover, .sg-header a:focus, .sg-header a.active { + color: white; + background: rgba(255, 255, 255, 0.05); } + .sg-header ol li ol li ol li a { + padding-left: 2em; + text-transform: none; } /* Navigation */ .sg-header .sg-nav-toggle { padding: 1em; border-bottom: 1px solid rgba(0, 0, 0, 0); position: relative; - z-index: 2; -} -@media all and (min-width: 44em) { - .sg-header .sg-nav-toggle { - display: none; - } -} + z-index: 2; } + @media all and (min-width: 44em) { + .sg-header .sg-nav-toggle { + display: none; } } @media all and (max-width: 44em) { .sg-nav-container { @@ -154,68 +137,46 @@ $STYLE GUIDE HEADER -moz-transition: max-height 0.5s ease-out; -ms-transition: max-height 0.5s ease-out; -o-transition: max-height 0.5s ease-out; - transition: max-height 0.5s ease-out; - } - .sg-nav-container.active { - max-height: 50em; - } -} + transition: max-height 0.5s ease-out; } + .sg-nav-container.active { + max-height: 50em; } } .sg-nav { z-index: 1; margin: 0; padding: 0; - list-style: none; -} -@media all and (min-width: 44em) { - .sg-nav > li { - border-bottom: 0; - border-right: 1px solid rgba(255, 255, 255, 0.05); - float: left; - position: relative; - } - .sg-nav > li > ol { - position: absolute; - top: 2em; - left: 0; - } -} - -.sg-nav-Pages ol { - width: 24em; -} -.sg-nav-Pages li { - float: left; - width: 50%; -} + list-style: none; } + @media all and (min-width: 44em) { + .sg-nav > li { + border-bottom: 0; + border-right: 1px solid rgba(255, 255, 255, 0.05); + float: left; + position: relative; } + .sg-nav > li > ol { + position: absolute; + top: 2em; + left: 0; } } /* Accordion */ .sg-acc-handle:after { content: ' +'; float: right; - font-size: 70%; -} -@media all and (min-width: 44em) { - .sg-acc-handle:after { - float: none; - } -} + font-size: 70%; } + @media all and (min-width: 44em) { + .sg-acc-handle:after { + float: none; } } .sg-acc-handle.active { color: white; - background: rgba(255, 255, 255, 0.05); -} -.sg-acc-handle.active:after { - content: ' -'; -} + background: rgba(255, 255, 255, 0.05); } + .sg-acc-handle.active:after { + content: ' -'; } .sg-acc-handle.sg-icon:after { - content: ""; -} + content: ""; } .sg-header .sg-icon { width: auto; font-size: 1rem; - padding: 0.5rem 1rem; -} + padding: 0.5rem 1rem; } .sg-acc-panel { overflow: hidden; @@ -226,16 +187,13 @@ $STYLE GUIDE HEADER -moz-transition: max-height 0.5s ease-out; -ms-transition: max-height 0.5s ease-out; -o-transition: max-height 0.5s ease-out; - transition: max-height 0.5s ease-out; -} -.sg-acc-panel.active { - max-height: 50em; -} -.sg-acc-panel.sg-right { - position: absolute; - left: auto; - right: 0; -} + transition: max-height 0.5s ease-out; } + .sg-acc-panel.active { + max-height: 50em; } + .sg-acc-panel.sg-right { + position: absolute; + left: auto; + right: 0; } /* Controls (sizing, view mode) */ .sg-controls { @@ -243,187 +201,147 @@ $STYLE GUIDE HEADER position: absolute; top: 0; right: 0; - z-index: 2; -} -.sg-controls .sg-acc-panel.active { - max-height: 17em; -} -.sg-controls .sg-nav-phases .sg-acc-panel { - min-width: 0; -} -.sg-controls .sg-nav-phases .sg-acc-panel.active { - max-height: none; -} + z-index: 2; } + .sg-controls .sg-acc-panel.active { + max-height: 17em; } + .sg-controls .sg-nav-phases .sg-acc-panel { + min-width: 0; } + .sg-controls .sg-nav-phases .sg-acc-panel.active { + max-height: none; } .sg-control-trigger { - border-bottom: 1px solid rgba(255, 255, 255, 0.05); -} -@media all and (min-width: 44em) { - .sg-control-trigger { - border: 0; - } -} -@media all and (min-width: 65em) { - .sg-control-trigger { - float: left; - width: 6em; - } -} + border-bottom: 1px solid rgba(255, 255, 255, 0.05); } + @media all and (min-width: 44em) { + .sg-control-trigger { + border: 0; } } + @media all and (min-width: 65em) { + .sg-control-trigger { + float: left; + width: 6em; } } @media all and (min-width: 44em) { .sg-control > li { float: left; border-bottom: 0; - border-left: 1px solid rgba(255, 255, 255, 0.05); - } -} + border-left: 1px solid rgba(255, 255, 255, 0.05); } } .sg-control > li { - float: left; -} + float: left; } .sg-control .sg-input { padding: 0.1em; -webkit-transition: all 0.2s ease-out; -moz-transition: all 0.2s ease-out; -ms-transition: all 0.2s ease-out; -o-transition: all 0.2s ease-out; - transition: all 0.2s ease-out; -} -.sg-control .sg-input:active, .sg-control .sg-input:focus { - outline: 0; - background: #f7f7f7; - color: #000; -} + transition: all 0.2s ease-out; } + .sg-control .sg-input:active, .sg-control .sg-input:focus { + outline: 0; + background: #f7f7f7; + color: #000; } @media all and (max-width: 65em) { .sg-quarter { float: left; width: 25%; border-left: 1px solid rgba(255, 255, 255, 0.05); - text-align: center; - } - .sg-quarter:first-child { - border-left: 0; - } -} + text-align: center; } + .sg-quarter:first-child { + border-left: 0; } } @media all and (max-width: 65em) { .sg-half { float: left; width: 50%; border-left: 1px solid rgba(255, 255, 255, 0.05); - text-align: center; - } - .sg-half:nth-child(odd) { - border-left: 0; - } -} + text-align: center; } + .sg-half:nth-child(odd) { + border-left: 0; } } .sg-current-size { font-size: 70%; color: gray; - padding: 0.8em 0.95em; -} -.sg-current-size:hover .sg-input { - background: #f7f7f7; - color: #000; -} -@media all and (min-width: 65em) { - .sg-current-size { - float: left; - } -} + padding: 0.8em 0.95em; } + .sg-current-size:hover .sg-input { + background: #f7f7f7; + color: #000; } + @media all and (min-width: 65em) { + .sg-current-size { + float: left; } } .sg-size-options { - max-width: 10em; -} -@media all and (min-width: 65em) { - .sg-size-options { - position: static; - max-height: none; - max-width: none; - } - .sg-size-options li { - float: left; - border: 0; - border-left: 1px solid rgba(255, 255, 255, 0.05); - } -} + max-width: 10em; } + @media all and (min-width: 65em) { + .sg-size-options { + position: static; + max-height: none; + max-width: none; } + .sg-size-options > li { + float: left; + border: 0; + border-left: 1px solid rgba(255, 255, 255, 0.05); } } #sg-form { margin: 0; border: 0; - padding: 0; -} + padding: 0; } .sg-input { margin: -2px 0 0 0; padding: 0; - border: 1px solid #222222; + border: 1px solid #222; background-color: #222; color: gray; width: 35px; - text-align: right; -} + text-align: right; } .sg-input-active { background-color: #fff; - color: #000; -} + color: #000; } .sg-view { - position: relative; -} -.sg-view > ul { - position: absolute; - top: 2em; - left: 0; -} + position: relative; } + .sg-view > ul { + position: absolute; + top: 2em; + left: 0; } .sg-checkbox:before { display: inline-block; - margin-right: 0.4em; -} + margin-right: 0.4em; } /*------------------------------------*\ - $STYLE GUIDE VIEWPORT - \*------------------------------------*/ + $STYLE GUIDE VIEWPORT +\*------------------------------------*/ /* Viewport */ #sg-vp-wrap { text-align: center; - width: 100%; -} -@media all and (min-width: 44em) { - #sg-vp-wrap { - position: fixed; - top: 2em; - bottom: 0; - left: 0; - right: 0; - z-index: 0; - } -} -#sg-vp-wrap.wrap-animate { - -webkit-transition: left 0.3s ease-out; - -moz-transition: left 0.3s ease-out; - -ms-transition: left 0.3s ease-out; - -o-transition: left 0.3s ease-out; - transition: left 0.3s ease-out; -} + width: 100%; } + @media all and (min-width: 44em) { + #sg-vp-wrap { + position: fixed; + top: 2em; + bottom: 0; + left: 0; + right: 0; + z-index: 0; } } + #sg-vp-wrap.wrap-animate { + -webkit-transition: left 0.3s ease-out; + -moz-transition: left 0.3s ease-out; + -ms-transition: left 0.3s ease-out; + -o-transition: left 0.3s ease-out; + transition: left 0.3s ease-out; } #sg-viewport { border: 0; x-margin: 0 auto; height: 100%; - width: 100%; -} -#sg-viewport.hay-mode { - -webkit-transition: all 40s linear; - -moz-transition: all 40s linear; - -ms-transition: all 40s linear; - -o-transition: all 40s linear; - transition: all 40s linear; -} + width: 100%; } + #sg-viewport.hay-mode { + -webkit-transition: all 40s linear; + -moz-transition: all 40s linear; + -ms-transition: all 40s linear; + -o-transition: all 40s linear; + transition: all 40s linear; } #sg-cover { width: 100%; @@ -431,29 +349,25 @@ $STYLE GUIDE HEADER display: none; position: absolute; z-index: 20; - cursor: col-resize; -} + cursor: col-resize; } #sg-gen-container { height: 100%; text-align: center; - margin: 0 auto; -} -#sg-gen-container.hay-mode { - -webkit-transition: all 40s linear; - -moz-transition: all 40s linear; - -ms-transition: all 40s linear; - -o-transition: all 40s linear; - transition: all 40s linear; -} + margin: 0 auto; } + #sg-gen-container.hay-mode { + -webkit-transition: all 40s linear; + -moz-transition: all 40s linear; + -ms-transition: all 40s linear; + -o-transition: all 40s linear; + transition: all 40s linear; } #sg-rightpull-container { width: 10px; float: right; margin: 0; height: 100%; - cursor: col-resize; -} + cursor: col-resize; } #sg-rightpull { margin: 0; @@ -464,194 +378,208 @@ $STYLE GUIDE HEADER -moz-transition: background 0.2s ease-out; -ms-transition: background 0.2s ease-out; -o-transition: background 0.2s ease-out; - transition: background 0.2s ease-out; -} -#sg-rightpull:hover { - background: #666; -} -#sg-rightpull:active { - cursor: col-resize; - background: #444; -} + transition: background 0.2s ease-out; } + #sg-rightpull:hover { + background: #666; } + #sg-rightpull:active { + cursor: col-resize; + background: #444; } .vp-animate { -webkit-transition: width 0.8s ease-out; -moz-transition: width 0.8s ease-out; -ms-transition: width 0.8s ease-out; -o-transition: width 0.8s ease-out; - transition: width 0.8s ease-out; -} + transition: width 0.8s ease-out; } /*------------------------------------*\ - $STYLE GUIDE CONTENT - \*------------------------------------*/ + $STYLE GUIDE CONTENT +\*------------------------------------*/ +/* Section Pattern */ +.sg-pattern { + margin-bottom: 2em; + overflow: hidden; } + /* Section Head */ -.sg-head { +.sg-pattern-head { margin: 2em 0; font-family: "HelveticaNeue", "Helvetica", "Arial", sans-serif; font-size: 70%; font-weight: normal; padding: 1em 0; -} -.sg-head a { - display: block; - border-bottom: 1px solid #222222; - color: #222; - text-decoration: none; -} -.sg-head a:hover { - color: gray; - border-bottom-color: gray; -} - -/* Section Pattern */ -.sg-pattern { - margin-bottom: 2em; - padding: 0 1em; - overflow: hidden; -} - -/* Section Sub-head */ -.sg-sub a:link { - color: gray; - border-bottom-color: gray; -} -.sg-sub a:link:hover { - color: #222222; - border-bottom-color: #222222; -} + border-bottom: 1px solid gray; } + .sg-pattern-head a { + display: block; + color: gray; + text-decoration: none; + cursor: pointer; } + .sg-pattern-head a:hover { + color: #222222; } /* Clean View */ .sg-clean .sg-main { - padding: 0; -} + padding: 0; } .sg-code, .sg-annotations { clear: both; background: #dddddd; color: #222222; - padding: 1em; - margin: 1em 0; -} - -.sg-code { - white-space: -moz-pre-wrap; - white-space: -pre-wrap; - white-space: -o-pre-wrap; + padding: 1em 0.5em; + margin: 1em 0; } + .sg-code a, .sg-annotations a { + text-decoration: underline; } + +.sg-code pre { + white-space: -moz-pre-line; + white-space: -pre-line; + white-space: -o-pre-line; word-wrap: break-word; - white-space: pre-wrap; -} + white-space: pre-line; + border: 1px solid rgba(0, 0, 0, 0.1); + padding: 0.5em; } + +.sg-code-contains { + margin-bottom: 1rem; + font-size: 85%; + color: gray; } + .sg-code-contains code { + padding: 0.2em; + background: rgba(0, 0, 0, 0.3); + color: #f7f7f7; + position: relative; + top: -2px; } + +.sg-code-head { + color: gray; + font-size: 1em; } .demo { overflow: hidden; - margin-bottom: 1rem; -} + margin-bottom: 1rem; } .demo .gi, .demo .demo-block { background: #dddddd; color: gray; text-align: center; margin-bottom: 0.5em; - padding: 1em !important; -} -.demo .gi:nth-of-type(2n), .demo .demo-block:nth-of-type(2n) { - color: #dddddd; - background: gray; -} -.demo .gi .gi, .demo .demo-block .gi { - background: rgba(0, 0, 0, 0.1); - color: #dddddd; -} -.demo .gi .gi:nth-of-type(2n), .demo .demo-block .gi:nth-of-type(2n) { - background: rgba(0, 0, 0, 0.3); -} + padding: 1em !important; } + .demo .gi:nth-of-type(2n), .demo .demo-block:nth-of-type(2n) { + color: #dddddd; + background: gray; } + .demo .gi .gi, .demo .demo-block .gi { + background: rgba(0, 0, 0, 0.1); + color: #dddddd; } + .demo .gi .gi:nth-of-type(2n), .demo .demo-block .gi:nth-of-type(2n) { + background: rgba(0, 0, 0, 0.3); } .demo-animate { background: #dddddd; padding: 1em; margin-bottom: 1em; - text-align: center; -} + text-align: center; } .animate-move { - position: relative; -} -.animate-move .demo-shape { - position: absolute; - top: 0; - left: 0; - bottom: 0; - width: 20px; - background: gray; -} -.animate-move:hover > .demo-shape { - left: 100%; - margin-left: -20px; -} + position: relative; } + .animate-move .demo-shape { + position: absolute; + top: 0; + left: 0; + bottom: 0; + width: 20px; + background: gray; } + .animate-move:hover > .demo-shape { + left: 100%; + margin-left: -20px; } .sg-colors { - overflow: hidden; -} -.sg-colors li { - overflow: hidden; - border: 1px solid #dddddd; - padding: 0.3em; - margin: 0 0.2em 0.2em 0; -} -@media all and (min-width: 30em) { + overflow: hidden; } .sg-colors li { - float: left; - width: 5em; - } -} + overflow: hidden; + border: 1px solid #dddddd; + padding: 0.3em; + margin: 0 0.2em 0.2em 0; } + @media all and (min-width: 30em) { + .sg-colors li { + float: left; + width: 5em; } } .sg-swatch { display: block; height: 1.5em; - width: 50%; -} -@media all and (max-width: 30em) { - .sg-swatch { - float: left; - margin-right: 0.3em; - } -} -@media all and (min-width: 30em) { - .sg-swatch { - width: 100%; - height: 4em; - margin-bottom: 0.2em; - } -} + width: 50%; } + @media all and (max-width: 30em) { + .sg-swatch { + float: left; + margin-right: 0.3em; } } + @media all and (min-width: 30em) { + .sg-swatch { + width: 100%; + height: 4em; + margin-bottom: 0.2em; } } .sg-label { - line-height: 1; -} + line-height: 1; } -#comment-container { +#sg-annotation-container { position: fixed; bottom: 0; left: 0; z-index: 99; width: 100%; - padding: 1em; - background: red; -} + padding: 1em; } + +/* Annotations */ +#sg-annotation-container, #sg-code-container { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + font-family: "HelveticaNeue", "Helvetica", "Arial", sans-serif; + font-size: 90%; + background: #222222; + color: gray; + position: fixed; + top: auto; + padding: 1rem 1rem 4rem; + bottom: 0; + left: 0; + width: 100%; + z-index: 2; + -webkit-transition: bottom 0.3s ease-out; + -moz-transition: bottom 0.3s ease-out; + -webkit-transition: bottom 0.3s ease-out; + -ms-transition: bottom 0.3s ease-out; + -o-transition: bottom 0.3s ease-out; + transition: bottom 0.3s ease-out; } + #sg-annotation-container a, #sg-code-container a { + color: #dddddd; } + +#sg-code-container pre { + max-height: 300px; + padding: 0 1em; } + +#sg-code-container .with-css pre { + max-height: 200px; } + +#sg-annotation-close-btn, #sg-code-close-btn { + color: #fff; + position: absolute; + top: 1em; + right: 1em; + text-transform: uppercase; + text-decoration: none; + text-align: right; } + +.has-comment, .has-comment a { + cursor: help !important; } @font-face { font-family: 'icons'; src: url("../assets/icons.eot"); src: url("../assets/icons.eot?#iefix") format("embedded-opentype"), url("../assets/icons.woff") format("woff"), url("../assets/icons.ttf") format("truetype"), url("../assets/icons.svg#icons") format("svg"); font-weight: normal; - font-style: normal; -} - -/* Use the following CSS code if you want to have a class per icon */ -/* -Instead of a list of all class selectors, -you can use the generic selector below, but it's slower: -[class*="icon-"] { - */ + font-style: normal; } + +/* Pattern Lab icon fonts */ .icon-reload, .icon-cog, .icon-minus, .icon-plus, .icon-menu, .sg-header .sg-nav-toggle, .icon-checkbox-unchecked, .sg-checkbox, .icon-checkbox-checked, .sg-checkbox.active, .icon-eye { font-family: 'icons'; speak: none; @@ -660,37 +588,28 @@ you can use the generic selector below, but it's slower: font-variant: normal; text-transform: none; line-height: 1; - -webkit-font-smoothing: antialiased; -} + -webkit-font-smoothing: antialiased; } .icon-reload:before { - content: "\e002"; -} + content: "\e002"; } .icon-cog:before { - content: "\e000"; -} + content: "\e000"; } .icon-minus:before { - content: "\e003"; -} + content: "\e003"; } .icon-plus:before { - content: "\e004"; -} + content: "\e004"; } .icon-menu:before, .sg-header .sg-nav-toggle:before { - content: "\e005"; -} + content: "\e005"; } .icon-checkbox-unchecked:before, .sg-checkbox:before { - content: "\e006"; -} + content: "\e006"; } .icon-checkbox-checked:before, .sg-checkbox.active:before { - content: "\e007"; -} + content: "\e007"; } .icon-eye:before { - content: "\e001"; -} + content: "\e001"; } diff --git a/public/styleguide/css/styleguide.scss b/public/styleguide/css/styleguide.scss index 7530207ee..5b4cd6d07 100644 --- a/public/styleguide/css/styleguide.scss +++ b/public/styleguide/css/styleguide.scss @@ -1,7 +1,6 @@ -@charset "UTF-8"; /*------------------------------------*\ - $STYLE GUIDE CONTAINER STYLES - \*------------------------------------*/ + $STYLE GUIDE CONTAINER STYLES +\*------------------------------------*/ /** * NOTE: These styles are specific to the style guide container and should not be modified. * Use style.scss for all content styles that don't pertain to the style guide container. @@ -11,8 +10,8 @@ /*------------------------------------*\ - $CONTENTS - \*------------------------------------*/ + $CONTENTS +\*------------------------------------*/ /** * STYLE GUIDE VARIABLES------------------Declarations of Sass variables * -----Font @@ -43,59 +42,59 @@ /*------------------------------------*\ - $STYLE GUIDE VARIABLES - \*------------------------------------*/ - /*Fonts*/ - $sg-font : "HelveticaNeue", "Helvetica", "Arial", sans-serif; + $STYLE GUIDE VARIABLES +\*------------------------------------*/ +/*Fonts*/ +$sg-font : "HelveticaNeue", "Helvetica", "Arial", sans-serif; - /* Style Guide Interface Colors */ - $sg-primary : #222; - $sg-secondary : #808080; - $sg-tertiary : #ddd; - $sg-quaternary : #fff; - $sg-quinary : #f7f7f7; - $sg-tint : rgba(255,255,255,0.05); - $sg-tint-2 : rgba(255,255,255,0.25); - $sg-tone : rgba(0,0,0,0.1); - $sg-tone-2 : rgba(0,0,0,0.3); +/* Style Guide Interface Colors */ +$sg-primary : #222; +$sg-secondary : #808080; +$sg-tertiary : #ddd; +$sg-quaternary : #fff; +$sg-quinary : #f7f7f7; +$sg-tint : rgba(255,255,255,0.05); +$sg-tint-2 : rgba(255,255,255,0.25); +$sg-tone : rgba(0,0,0,0.1); +$sg-tone-2 : rgba(0,0,0,0.3); - /* Typography */ - $sg-font-size-norm : 100%; - $sg-font-size-sm : 70%; - $sg-font-size-large : 120%; +/* Typography */ +$sg-font-size-norm : 100%; +$sg-font-size-sm : 70%; +$sg-font-size-large : 120%; - /* Defaults */ - $sg-space : 1em; - $sg-doublespace : $sg-space*2; - $sg-pad : 1em; - $sg-halfpad : $sg-pad/2; +/* Defaults */ +$sg-space : 1em; +$sg-doublespace : $sg-space*2; +$sg-pad : 1em; +$sg-pad-half : $sg-pad/2; - /* Dimensions */ - $offset-top: 2em; +/* Dimensions */ +$offset-top: 2em; - /* Breakpoints */ - $sg-bp-small : 24em; - $sg-bp-small-2 : 30em; - $sg-bp-med : 44em; - $sg-bp-large : 65em; - $sg-bp-xl : 80em; +/* Breakpoints */ +$sg-bp-small : 24em; +$sg-bp-small-2 : 30em; +$sg-bp-med : 44em; +$sg-bp-large : 65em; +$sg-bp-xl : 80em; - $animate-quick: 0.2s; +$animate-quick: 0.2s; /*------------------------------------*\ - $STYLE GUIDE MIXINS - \*------------------------------------*/ - @mixin sg-transition($transition-property, $transition-time, $method) { - -webkit-transition: $transition-property $transition-time $method; - -moz-transition: $transition-property $transition-time $method; - -ms-transition: $transition-property $transition-time $method; - -o-transition: $transition-property $transition-time $method; - transition: $transition-property $transition-time $method; - } + $STYLE GUIDE MIXINS +\*------------------------------------*/ +@mixin sg-transition($transition-property, $transition-time, $method) { + -webkit-transition: $transition-property $transition-time $method; + -moz-transition: $transition-property $transition-time $method; + -ms-transition: $transition-property $transition-time $method; + -o-transition: $transition-property $transition-time $method; + transition: $transition-property $transition-time $method; +} @@ -103,40 +102,36 @@ /*------------------------------------*\ - $STYLE GUIDE INTERFACE - \*------------------------------------*/ - - html, body { - margin: 0; - padding: 0; - background: $sg-tertiary; - -webkit-text-size-adjust: 100%; - } + $STYLE GUIDE INTERFACE +\*------------------------------------*/ - html#pattern-frame { - background: #fff; - } +#patternlab-html, #patternlab-body { + margin: 0; + padding: 0; + background: $sg-tertiary; + -webkit-text-size-adjust: 100%; +} - .sg-nav-wrapper { - overflow: hidden; - background: $sg-tertiary; - } +.sg-nav-wrapper { + overflow: hidden; + background: $sg-tertiary; +} - .is-vishidden { - position: absolute !important; - overflow: hidden; - width: 1px; - height: 1px; - padding: 0; - border: 0; - clip: rect(1px, 1px, 1px, 1px); - } +.is-vishidden { + position: absolute !important; + overflow: hidden; + width: 1px; + height: 1px; + padding: 0; + border: 0; + clip: rect(1px, 1px, 1px, 1px); +} /*------------------------------------*\ -$STYLE GUIDE HEADER + $STYLE GUIDE HEADER \*------------------------------------*/ /* Header */ .sg-header { @@ -155,9 +150,9 @@ $STYLE GUIDE HEADER box-shadow: inset 0 1px 0 #5f6164,inset 0 -1px 0 #2e2f2f,0 1px 3px rgba(0,0,0,0.3); * { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; } ul, ol { @@ -185,12 +180,28 @@ $STYLE GUIDE HEADER } } - ol li ol li ol li a{ - padding-left: 2em; - text-transform: capitalize; - } + ol{ + li{ + ol{ + li{ + ol{ + li{ + //3rd level nav item + a { + padding-left: 2em; + text-transform: none; + } + } + } + } + } + } + } + } + + /* Navigation */ .sg-header .sg-nav-toggle { @extend .icon-menu; @@ -239,16 +250,6 @@ $STYLE GUIDE HEADER } } -.sg-nav-Pages { - ol { - width: 24em; - } - li { - float: left; - width: 50%; - } -} - /* Accordion */ .sg-acc-handle { &:after { @@ -311,11 +312,11 @@ $STYLE GUIDE HEADER } .sg-nav-phases .sg-acc-panel { - min-width: 0; - - &.active { - max-height: none; - } + min-width: 0; + + &.active { + max-height: none; + } } } @@ -353,10 +354,10 @@ $STYLE GUIDE HEADER .sg-input { padding: 0.1em; -webkit-transition: all $animate-quick ease-out; - -moz-transition: all $animate-quick ease-out; - -ms-transition: all $animate-quick ease-out; - -o-transition: all $animate-quick ease-out; - transition: all $animate-quick ease-out; + -moz-transition: all $animate-quick ease-out; + -ms-transition: all $animate-quick ease-out; + -o-transition: all $animate-quick ease-out; + transition: all $animate-quick ease-out; &:active, &:focus { outline: 0; @@ -393,21 +394,21 @@ $STYLE GUIDE HEADER } .sg-current-size { - font-size: 70%; - color: $sg-secondary; - padding: 0.8em 0.95em; + font-size: 70%; + color: $sg-secondary; + padding: 0.8em 0.95em; - &:hover { - .sg-input { - background: $sg-quinary; - color: #000; + &:hover { + .sg-input { + background: $sg-quinary; + color: #000; + } } - } - @media all and (min-width: $sg-bp-large) { - float: left; + @media all and (min-width: $sg-bp-large) { + float: left; + } } -} .sg-size-options { max-width: 10em; @@ -417,7 +418,7 @@ $STYLE GUIDE HEADER max-height: none; max-width: none; - li { + > li { float: left; border: 0; border-left: 1px solid $sg-tint; @@ -472,158 +473,149 @@ $STYLE GUIDE HEADER /*------------------------------------*\ - $STYLE GUIDE VIEWPORT - \*------------------------------------*/ - - /* Viewport */ - #sg-vp-wrap { - text-align: center; - width: 100%; - - @media all and (min-width: $sg-bp-med) { - position: fixed; - top: $offset-top; - bottom: 0; - left: 0; - right: 0; - z-index: 0; - } + $STYLE GUIDE VIEWPORT +\*------------------------------------*/ - &.wrap-animate { - -webkit-transition: left 0.3s ease-out; - -moz-transition: left 0.3s ease-out; - -ms-transition: left 0.3s ease-out; - -o-transition: left 0.3s ease-out; - transition: left 0.3s ease-out; - } +/* Viewport */ +#sg-vp-wrap { + text-align: center; + width: 100%; + @media all and (min-width: $sg-bp-med) { + position: fixed; + top: $offset-top; + bottom: 0; + left: 0; + right: 0; + z-index: 0; } - #sg-viewport { - border: 0; - x-margin: 0 auto; - height: 100%; - width: 100%; - - &.hay-mode { - -webkit-transition: all 40s linear; - -moz-transition: all 40s linear; - -ms-transition: all 40s linear; - -o-transition: all 40s linear; - transition: all 40s linear; - } + &.wrap-animate { + -webkit-transition: left 0.3s ease-out; + -moz-transition: left 0.3s ease-out; + -ms-transition: left 0.3s ease-out; + -o-transition: left 0.3s ease-out; + transition: left 0.3s ease-out; } - #sg-cover { - width: 100%; - height: 100%; - display: none; - position: absolute; - z-index: 20; - cursor: col-resize; - } +} - #sg-gen-container { - height: 100%; - text-align: center; - margin: 0 auto; +#sg-viewport { + border: 0; + x-margin: 0 auto; + height: 100%; + width: 100%; - &.hay-mode { - -webkit-transition: all 40s linear; - -moz-transition: all 40s linear; - -ms-transition: all 40s linear; - -o-transition: all 40s linear; - transition: all 40s linear; - } + &.hay-mode { + -webkit-transition: all 40s linear; + -moz-transition: all 40s linear; + -ms-transition: all 40s linear; + -o-transition: all 40s linear; + transition: all 40s linear; } +} - #sg-rightpull-container { - width: 10px; - float: right; - margin: 0; - height: 100%; - cursor: col-resize; +#sg-cover { + width: 100%; + height: 100%; + display: none; + position: absolute; + z-index: 20; + cursor: col-resize; +} + +#sg-gen-container { + height: 100%; + text-align: center; + margin: 0 auto; + -webkit-overflow-scrolling: touch; + overflow: scroll; + + &.hay-mode { + -webkit-transition: all 40s linear; + -moz-transition: all 40s linear; + -ms-transition: all 40s linear; + -o-transition: all 40s linear; + transition: all 40s linear; } +} - #sg-rightpull { - margin: 0; - width: 10px; - height: 100%; - background: #999; - -webkit-transition: background $animate-quick ease-out; - -moz-transition: background $animate-quick ease-out; - -ms-transition: background $animate-quick ease-out; - -o-transition: background $animate-quick ease-out; - transition: background $animate-quick ease-out; +#sg-rightpull-container { + width: 10px; + float: right; + margin: 0; + height: 100%; + cursor: col-resize; +} - &:hover { - background: #666; - } +#sg-rightpull { + margin: 0; + width: 10px; + height: 100%; + background: #999; + -webkit-transition: background $animate-quick ease-out; + -moz-transition: background $animate-quick ease-out; + -ms-transition: background $animate-quick ease-out; + -o-transition: background $animate-quick ease-out; + transition: background $animate-quick ease-out; - &:active { - cursor: col-resize; - background: #444; - } + &:hover { + background: #666; } - .vp-animate { - -webkit-transition: width 0.8s ease-out; - -moz-transition: width 0.8s ease-out; - -ms-transition: width 0.8s ease-out; - -o-transition: width 0.8s ease-out; - transition: width 0.8s ease-out; + &:active { + cursor: col-resize; + background: #444; } +} + +.vp-animate { + -webkit-transition: width 0.8s ease-out; + -moz-transition: width 0.8s ease-out; + -ms-transition: width 0.8s ease-out; + -o-transition: width 0.8s ease-out; + transition: width 0.8s ease-out; +} /*------------------------------------*\ - $STYLE GUIDE CONTENT - \*------------------------------------*/ + $STYLE GUIDE CONTENT +\*------------------------------------*/ - /* Section Head */ - .sg-head { - margin: $sg-doublespace 0; - font-family: $sg-font; - font-size: $sg-font-size-sm; - font-weight: normal; - padding: $sg-pad 0; - - a { - display: block; - border-bottom: 1px solid $sg-primary; - color: #222; - text-decoration: none; - - &:hover { - color: $sg-secondary; - border-bottom-color: $sg-secondary; - } - } - } +/* Section Pattern */ +.sg-pattern { + margin-bottom: $sg-doublespace; + overflow: hidden; +} - /* Section Pattern */ - .sg-pattern { - margin-bottom: $sg-doublespace; - padding: 0 $sg-pad; - overflow: hidden; - } +/* Section Head */ +.sg-pattern-head { + margin: $sg-doublespace 0; + font-family: $sg-font; + font-size: $sg-font-size-sm; + font-weight: normal; + padding: $sg-pad 0; + border-bottom: 1px solid $sg-secondary; - /* Section Sub-head */ - .sg-sub a:link { + a { + display: block; color: $sg-secondary; - border-bottom-color: $sg-secondary; + text-decoration: none; + cursor: pointer; + &:hover { color: $sg-primary; - border-bottom-color: $sg-primary; } } +} - /* Clean View */ - .sg-clean .sg-main { - padding: 0; - } +/* Clean View */ +.sg-clean .sg-main { + padding: 0; +} // Code View Blocks @@ -631,16 +623,43 @@ $STYLE GUIDE HEADER clear: both; background: $sg-tertiary; color: $sg-primary; - padding: $sg-pad; + padding: $sg-pad $sg-pad-half; margin: $sg-space 0; + + a { + text-decoration: underline; + } } .sg-code { - white-space: -moz-pre-wrap; - white-space: -pre-wrap; - white-space: -o-pre-wrap; - word-wrap: break-word; - white-space: pre-wrap; + pre { + white-space: -moz-pre-line; + white-space: -pre-line; + white-space: -o-pre-line; + word-wrap: break-word; + white-space: pre-line; + border: 1px solid $sg-tone; + padding: $sg-pad-half; + } +} + +.sg-code-contains { + margin-bottom: 1rem; + font-size: 85%; + color: $sg-secondary; + + code { + padding: 0.2em; + background: $sg-tone-2; + color: $sg-quinary; + position: relative; + top: -2px; + } +} + +.sg-code-head { + color: $sg-secondary; + font-size: 1em; } // Demo to show grid system - in this stylesheet because it shouldn't be included in the production styles @@ -652,7 +671,7 @@ $STYLE GUIDE HEADER background: $sg-tertiary; color: $sg-secondary; text-align: center; - margin-bottom: $sg-halfpad; + margin-bottom: $sg-pad-half; padding: 1em !important; &:nth-of-type(2n) { @@ -739,14 +758,65 @@ $STYLE GUIDE HEADER } //Annotation -#comment-container { +#sg-annotation-container { position: fixed; bottom: 0; left: 0; z-index: 99; width: 100%; padding: $sg-pad; - background: red; +} + + +/* Annotations */ +#sg-annotation-container, #sg-code-container { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + font-family: $sg-font; + font-size: 90%; + background: $sg-primary; + color: $sg-secondary; + position: fixed; + top: auto; + padding: 1rem 1rem 4rem; + bottom: 0; + left: 0; + width: 100%; + z-index: 2; + -webkit-transition: bottom 0.3s ease-out; + -moz-transition: bottom 0.3s ease-out; + -webkit-transition: bottom 0.3s ease-out; + -ms-transition: bottom 0.3s ease-out; + -o-transition: bottom 0.3s ease-out; + transition: bottom 0.3s ease-out; + + a { + color: $sg-tertiary; + } +} + +#sg-code-container pre { + max-height: 300px; + padding: 0 1em; +} + +#sg-code-container .with-css pre { + max-height: 200px; +} + +#sg-annotation-close-btn, #sg-code-close-btn { + color: #fff; + position: absolute; + top: 1em; + right: 1em; + text-transform: uppercase; + text-decoration: none; + text-align: right; +} + +.has-comment, .has-comment a { + cursor: help !important; } // Icon Font @@ -755,50 +825,45 @@ $STYLE GUIDE HEADER font-family: 'icons'; src:url('../assets/icons.eot'); src:url('../assets/icons.eot?#iefix') format('embedded-opentype'), - url('../assets/icons.woff') format('woff'), - url('../assets/icons.ttf') format('truetype'), - url('../assets/icons.svg#icons') format('svg'); + url('../assets/icons.woff') format('woff'), + url('../assets/icons.ttf') format('truetype'), + url('../assets/icons.svg#icons') format('svg'); font-weight: normal; font-style: normal; } -/* Use the following CSS code if you want to have a class per icon */ -/* -Instead of a list of all class selectors, -you can use the generic selector below, but it's slower: -[class*="icon-"] { - */ - .icon-reload, .icon-cog, .icon-minus, .icon-plus, .icon-menu, .icon-checkbox-unchecked, .icon-checkbox-checked, .icon-eye { - font-family: 'icons'; - speak: none; - font-style: normal; - font-weight: normal; - font-variant: normal; - text-transform: none; - line-height: 1; - -webkit-font-smoothing: antialiased; - } - .icon-reload:before { - content: "\e002"; - } - .icon-cog:before { - content: "\e000"; - } - .icon-minus:before { - content: "\e003"; - } - .icon-plus:before { - content: "\e004"; - } - .icon-menu:before { - content: "\e005"; - } - .icon-checkbox-unchecked:before { - content: "\e006"; - } - .icon-checkbox-checked:before { - content: "\e007"; - } - .icon-eye:before { - content: "\e001"; - } \ No newline at end of file +/* Pattern Lab icon fonts */ +.icon-reload, .icon-cog, .icon-minus, .icon-plus, .icon-menu, .icon-checkbox-unchecked, .icon-checkbox-checked, .icon-eye { + font-family: 'icons'; + speak: none; + font-style: normal; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + -webkit-font-smoothing: antialiased; +} +.icon-reload:before { + content: "\e002"; +} +.icon-cog:before { + content: "\e000"; +} +.icon-minus:before { + content: "\e003"; +} +.icon-plus:before { + content: "\e004"; +} +.icon-menu:before { + content: "\e005"; +} +.icon-checkbox-unchecked:before { + content: "\e006"; +} +.icon-checkbox-checked:before { + content: "\e007"; +} +.icon-eye:before { + content: "\e001"; +} diff --git a/public/styleguide/js/annotations-pattern.js b/public/styleguide/js/annotations-pattern.js new file mode 100644 index 000000000..1855c7137 --- /dev/null +++ b/public/styleguide/js/annotations-pattern.js @@ -0,0 +1,212 @@ +/*! + * Annotations Support for Patterns - v0.3 + * + * Copyright (c) 2013 Dave Olsen, http://dmolsen.com + * Licensed under the MIT license + * + */ + +var annotationsPattern = { + + commentsOverlayActive: false, + commentsOverlay: false, + commentsOverlayElement: "", + commentsEmbeddedActive: false, + commentsEmbedded: false, + + /** + * add an onclick handler to each element in the pattern that has an annotation + */ + showComments: function() { + + // make sure this only added when we're on a pattern specific view + var body = document.getElementsByTagName("body"); + if (!body[0].classList.contains("sg-pattern-list")) { + for (comment in comments.comments) { + var item = comments.comments[comment]; + var els = document.querySelectorAll(item.el); + for (var i = 0; i < els.length; ++i) { + els[i].onclick = (function(item) { + return function(e) { + e.preventDefault(); + e.stopPropagation(); + var obj = {}; + + if (annotationsPattern.commentsOverlayActive && !annotationsPattern.commentsOverlay) { + + // if this is for an overlay and comments overlay is false set the payload to turn the overlay on + annotationsPattern.commentsOverlay = true; + obj = { "commentOverlay": "on", "swapOverlay": false, "el": item.el, "title": item.title, "comment": item.comment }; + + } else if (annotationsPattern.commentsOverlayActive && annotationsPattern.commentsOverlay) { + + if (item.el == annotationsPattern.commentsOverlayElement) { + + // if the last element was clicked again turn off the overlay + annotationsPattern.commentsOverlay = false; + obj = { "commentOverlay": "off" }; + + } else { + + // if an element was clicked on while the overlay was already on swap it + obj = { "commentOverlay": "on", "swapOverlay": true, "el": item.el, "title": item.title, "comment": item.comment }; + + } + + } + + annotationsPattern.commentsOverlayElement = item.el; + var targetOrigin = (window.location.protocol == "file:") ? "*" : window.location.protocol+"//"+window.location.host; + parent.postMessage(obj,targetOrigin); + + } + })(item); + } + } + } + + }, + + /** + * embed a comment by building the sg-annotations div (if necessary) and building an sg-annotation div + * @param {Object} element to check the parent node of + * @param {String} the title of the comment + * @param {String} the comment HTML + */ + embedComments: function (el,title,comment) { + + // build the annotation div and add the content to it + var annotationDiv = document.createElement("div"); + annotationDiv.classList.add("sg-annotation"); + + var h3 = document.createElement("h3"); + var p = document.createElement("p"); + h3.innerHTML = title; + p.innerHTML = comment; + + annotationDiv.appendChild(h3); + annotationDiv.appendChild(p); + + // find the parent element to attach things to + var parentEl = annotationsPattern.findParent(el); + + // see if a child with the class annotations exists + var els = parentEl.getElementsByClassName("sg-annotations"); + if (els.length > 0) { + els[0].appendChild(annotationDiv); + } else { + var annotationsDiv = document.createElement("div"); + annotationsDiv.classList.add("sg-annotations"); + annotationsDiv.appendChild(annotationDiv); + parentEl.appendChild(annotationsDiv); + } + + }, + + /** + * recursively find the parent of an element to see if it contains the sg-pattern class + * @param {Object} element to check the parent node of + */ + findParent: function(el) { + + if (el.parentNode.classList.contains("sg-pattern")) { + return el.parentNode; + } else { + var parentEl = annotationsPattern.findParent(el.parentNode); + } + + return parentEl; + + }, + + /** + * toggle the annotation feature on/off + * based on the great MDN docs at https://developer.mozilla.org/en-US/docs/Web/API/window.postMessage + * @param {Object} event info + */ + receiveIframeMessage: function(event) { + + // does the origin sending the message match the current host? if not dev/null the request + if ((window.location.protocol != "file:") && (event.origin !== window.location.protocol+"//"+window.location.host)) { + return; + } + + if (event.data.commentToggle != undefined) { + + // if this is an overlay make sure it's active for the onclick event + annotationsPattern.commentsOverlayActive = false; + annotationsPattern.commentsEmbeddedActive = false; + + // see which flag to toggle based on if this is a styleguide or view-all page + var body = document.getElementsByTagName("body"); + if ((event.data.commentToggle == "on") && (body[0].classList.contains("sg-pattern-list"))) { + annotationsPattern.commentsEmbeddedActive = true; + } else if (event.data.commentToggle == "on") { + annotationsPattern.commentsOverlayActive = true; + } + + // if comments overlay is turned off make sure to remove the has-comment class and pointer + if (!annotationsPattern.commentsOverlayActive) { + var els = document.querySelectorAll(".has-comment"); + for (var i = 0; i < els.length; i++) { + els[i].classList.remove("has-comment"); + } + } + + // if comments embedding is turned off make sure to hide the annotations div + if (!annotationsPattern.commentsEmbeddedActive) { + var els = document.getElementsByClassName("sg-annotations"); + for (var i = 0; i < els.length; i++) { + els[i].style.display = "none"; + } + } + + // if comments overlay is turned on add the has-comment class and pointer + if (annotationsPattern.commentsOverlayActive) { + + for (comment in comments.comments) { + var item = comments.comments[comment]; + var els = document.querySelectorAll(item.el); + for (var i = 0; i < els.length; i++) { + els[i].classList.add("has-comment"); + } + } + + } else if (annotationsPattern.commentsEmbeddedActive && !annotationsPattern.commentsEmbedded) { + + // if comment embedding is turned on and comments haven't been embedded yet do it + for (comment in comments.comments) { + var item = comments.comments[comment]; + var els = document.querySelectorAll(item.el); + if (els.length > 0) { + annotationsPattern.embedComments(els[0],item.title,item.comment); + } + annotationsPattern.commentsEmbedded = true; + } + + } else if (annotationsPattern.commentsEmbeddedActive && annotationsPattern.commentsEmbedded) { + + // if comment embedding is turned on and comments have been embedded simply display them + var els = document.getElementsByClassName("sg-annotations"); + for (var i = 0; i < els.length; ++i) { + els[i].style.display = "block"; + } + + } + + } + + } + +}; + +// add the onclick handlers to the elements that have an annotations +annotationsPattern.showComments(); +window.addEventListener("message", annotationsPattern.receiveIframeMessage, false); + +// before unloading the iframe make sure any active overlay is turned off/closed +window.onbeforeunload = function() { + var obj = { "commentOverlay": "off" }; + var targetOrigin = (window.location.protocol == "file:") ? "*" : window.location.protocol+"//"+window.location.host; + parent.postMessage(obj,targetOrigin); +}; \ No newline at end of file diff --git a/public/styleguide/js/annotations-viewer.js b/public/styleguide/js/annotations-viewer.js new file mode 100644 index 000000000..ea0fbea09 --- /dev/null +++ b/public/styleguide/js/annotations-viewer.js @@ -0,0 +1,138 @@ +/*! + * Annotations Support for the Viewer - v0.3 + * + * Copyright (c) 2013 Brad Frost, http://bradfrostweb.com & Dave Olsen, http://dmolsen.com + * Licensed under the MIT license + * + */ + +var annotationsViewer = { + + commentsActive: false, + sw: document.documentElement.clientWidth, + breakpoint: 650, + + onReady: function() { + + $('body').addClass('comments-ready'); + $('#sg-t-annotations').click(function(e) { + + e.preventDefault(); + + // make sure the code view overlay is off + $('#sg-t-code').removeClass('active'); + codeViewer.codeActive = false; + var targetOrigin = (window.location.protocol == "file:") ? "*" : window.location.protocol+"//"+window.location.host; + document.getElementById('sg-viewport').contentWindow.postMessage({ "codeToggle": "off" },targetOrigin); + codeViewer.slideCode(999); + + annotationsViewer.toggleComments(); + annotationsViewer.commentContainerInit(); + + }); + + }, + + toggleComments: function() { + + var targetOrigin = (window.location.protocol == "file:") ? "*" : window.location.protocol+"//"+window.location.host; + $('#sg-t-annotations').toggleClass('active'); + + if (!annotationsViewer.commentsActive) { + + annotationsViewer.commentsActive = true; + document.getElementById('sg-viewport').contentWindow.postMessage({ "commentToggle": "on" },targetOrigin); + + } else { + + annotationsViewer.commentsActive = false; + document.getElementById('sg-viewport').contentWindow.postMessage({ "commentToggle": "off" },targetOrigin); + annotationsViewer.slideComment(999); + + } + + }, + + commentContainerInit: function() { + + if (document.getElementById("sg-annotation-container") == undefined) { + $('').html('Close
t |