Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Pair to Define Toggle Control #2889

Closed
mcharg opened this issue May 25, 2018 · 17 comments
Closed

Pair to Define Toggle Control #2889

mcharg opened this issue May 25, 2018 · 17 comments
Assignees

Comments

@mcharg
Copy link
Contributor

mcharg commented May 25, 2018

This will be a test for processes for creating new visual design.

@jenniferthibault
Copy link

Last sprint, we found that the component we thought was an existing toggle was actually a tab in disguise. We also identified styling new things as an area of low confidence on the team in last sprint's workshop, so this makes a great opportunity to work on both areas.

The upcoming disbursement data wireframes incorporate toggle components, so Shannon and I will pair through styling a new toggle component for the site together.

@mcharg
Copy link
Contributor Author

mcharg commented May 30, 2018

@jenniferthibault Now that we've defined what the toggle should look like, what's the next step to getting it in the style guide?

@jenniferthibault
Copy link

jenniferthibault commented May 31, 2018

Next steps would be to:

  1. Capture the design in this github issue to document for the rest of the team where we landed on the first draft, and get the chance for quick feedback, if there is any at this point. Capture:

    • parameters that informed our design choices
    • examples of default styles
    • examples of interaction states
    • examples of responsive state changes
  2. Create a new issue for building the component in code. Completion criteria might include:

    • building the master CSS/HTML style classes
    • pair with designer to check styles
    • add component to mockups or prototypes (if ready)
    • adding component to the style guide (this could theoretically be separate, but I like to do it all in one to make it part of the regular process)

I often find that it's helpful to have whoever styled the thing pair with whoever is building the thing in code to look at an example of the component when they're nearing a first draft, but before filing a pull request. This helps make sure you're both on the same page, and is a good chance to make sure everything looks and works like you expected it to early on.

  1. Create another new issue for writing notes and documentation for how this component is used that will fill in the style guide notes tab.
    • Optionally, this could be included in the first or second issue, but I find it's helpful to separate content tasks from code-based implementation tasks. And often, the team members capable/responsible for each will be different people. It's likely that the notes/documentation content for a component might need slight updates over time as the component is used in more places, and you have a firmer understanding of the site's guidelines.

This is how I've done it before, but of course you all will find what works for you.

@mcharg are you up for updating this issue with the items from step 1? I'd also be glad to give it a first pass if you'd rather see an example first.

@mcharg
Copy link
Contributor Author

mcharg commented May 31, 2018

@jenniferthibault Yes, I can do #1.

@mcharg
Copy link
Contributor Author

mcharg commented May 31, 2018

Parameters that informed the design choices

  • Match to existing patterns
  • Match to known use cases
  • Used styling to go with secondary and tertiary buttons

Default States

Desktop

toggledesktop

Mobile

togglemobile

Images instead of text

image

Prototype for interactivity

Desktop: https://ofxchl.axshare.com/#g=1&p=toggle&view=default
Mobile: https://ofxchl.axshare.com/#g=1&p=toggle&view=a

Specifications

  • 5 px corner radius on the left and right (or top and bottom on mobile) buttons.
  • 0 px corner radius on center buttons.
  • Selected button color and font match the styling for tertiary buttons.
  • Unselected button color and font match the styling for secondary buttons.
  • When the screen hits the mobile breakpoint where surrounding content changes to a mobile view (usually 768 px or 600 px) they switch to the mobile display with stacked buttons.
  • When stacked on mobile, the pixel height increases to 40px per button and the width of the screen minus margins.
  • Button width should adjust to fit the text on the button with a minimum width of 40 px and a max width of 300 px.
  • The max width for a set of toggles is 768 px.
  • Toggles should accept icons as the content, instead of text in some instances.
  • Labels on toggles should not wrap or truncate. If labels are too long, we should shorten the labels or use a different control.

@jenniferthibault
Copy link

@mcharg this is great, especially how you're showing interaction prototypes and referencing other patterns that set the styles for this one. One way to make that stronger would be to link references to those patterns to their pages in the style guide.
For example:

The only parameter I'd add is that we also need this toggle to accept icons as the content, instead of text in some instances. I'd add that to the list with an example prototype or screenshot.

@master12 as the receiver and user of these notes, is there any info missing or anything you'd do differently?

@mcharg
Copy link
Contributor Author

mcharg commented Jun 4, 2018

Created #2911 to address step 2 above.

@mcharg
Copy link
Contributor Author

mcharg commented Jun 4, 2018

Created #2918 to address step 3 above.

@mcharg
Copy link
Contributor Author

mcharg commented Jun 4, 2018

@master12 Do you have any feedback on the specifications?

@master12
Copy link
Contributor

master12 commented Jun 4, 2018

A couple questions:

  1. Is there a max width or min width?
  2. For mobile we may want to set a breakpoint for screen width
  3. If we use text do the buttons wrap if they stretch to far? Or we switch to mobile?
  4. If we set max width what happens to the text inside the button? Wrap? Clipped?

Thats what I have so far.

@mcharg
Copy link
Contributor Author

mcharg commented Jun 4, 2018

  1. Min width: 40 px, Max width: 300 px per button and 768 px for a set of toggles.
  2. Mobile: Breakpoint is 768 px
  3. Switch to mobile. We should aim for short labels.
  4. We create a shorter label, so it fits.

@master12
Copy link
Contributor

master12 commented Jun 4, 2018

I will check what the breakpoint is we use now and go with that. There are general guidelines so I assume we are using that.

@jenniferthibault
Copy link

Your breakpoints are defined in the .scss here: https://github.com/18F/doi-extractives-data/blob/dev/_sass/_grid.scss#L8

// Breakpoints
$tiny: em(480);
$small: em(600);
$medium: em(768);
$large: em(900);
$huge: em(960);
$huge-plus: $huge + em($max-vw-margins);
$jumbo: em(1500);
$massive: em(1800);

@mcharg
Copy link
Contributor Author

mcharg commented Jun 4, 2018

@jenniferthibault Is there a rough translation for how many pixels = an em?

@jenniferthibault
Copy link

@mcharg to answer your question, I've been digging myself into a rabbit hole on this and could use some help from @mentastc . In the expressions copied above, does em(480) = 480em?

Sharing my reading list:

@brentryanjohnson
Copy link
Contributor

@jenniferthibault and @mcharg I believe you're looking at Sass em() function declarations that accept pixel values and convert them to ems in the CSS output.

The values you see in the Sass file should be pixel values. I checked this out and found an obvious breakpoint at 768 px, which is declared as a breakpoint in the stylesheet.

breakpoint

@mcharg
Copy link
Contributor Author

mcharg commented Jun 5, 2018

I updated the specs to reflect the 768 px breakpoint.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants