-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent spacing between Icon/Text #130
Comments
I've calculated the width of a
I've then used that as the base margin between icon and text for our prototype. |
In looking at the table:
|
@natalia-fitzgerald Updated to reflect known use cases Icon alignment looks improved in the latest deployment. I didn't change anything to specifically address that...so not sure what was going wrong in the first iteration. Alignment still looks off for |
@natalia-fitzgerald Issue seems related to a couple things:
Not sure there is a consistent styling fix for this or if it would fall under design usage guidelines i.e. Don't use icons next to words that begin with a lower case letter. |
@meissadia - Can you show this table with a circle icon for comparison? |
@meissadia - Does the vertical alignment shown here match what is done on the rest of the site and in the Design System? |
@natalia-fitzgerald I hacked together this example by editing the HTML on the CFPB Iconography page and, yes, it appears that this behavior is consistent with the CFPB DS, and thus should also reflect how the SBL site would render icons. ![]() |
Trying to find a way to accomplish this consistent spacing via CSS, so that devs would not need to encapsulate text+icon in any special wrappers...but it seems that CSS does not have the ability to recognize plain text. So targeting scenarios where the icon comes before/after text, and applying the appropriate spacing, is proving more involved than I'd hoped. After listing out the investigation below, I'm tempted to say that continuing with the current approach of "Devs just need to insert a Alternative approaches:
Examples from CF.gov of text + icon |
DS Heading with Icon variant: https://cfpb.github.io/design-system/foundation/headings#variations-1 |
Classes used in the examples above
Possible solution:
TODO: I need to try this out in code to see how achievable it is. |
So I don't think we can achieve the consistent spacing we're looking for without requiring significant retrofitting for all existing usages of DS icons. The table below demonstrates an extreme example of the approach described above. In the first two columns the SVG element appears next to raw text i.e. CSS cannot target raw text, so in order to apply CSS based spacing between icons and text, we'd need to wrap that text in an HTML element (last two columns), which means this approach would need to be retroactively applied in ALL instances where the spacing is currently achieved by putting a space(' ' or ) between the icon and the text. This seems like a significant overhaul to all of CF.gov and probably outside the scope of our current efforts. That said, we can still achieve this consistent spacing in DSR and the SBL app. So we can discuss if we'd like to move forward with this. |
@meissadia |
I'm imagining an entry in Storybook along the lines of our Icon tables that would display the following scenarios for easy comparison.
And similar to the way jump icons are handled, we would want to enforce consistent spacing between icon + text via CSS, so this will need to be implemented.
The text was updated successfully, but these errors were encountered: