question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create consumer button themes

See original GitHub issue

Issue Description

As an application developer, I need predefined consumer button themes available so that i can apply it to terra button.

Example:

import Button from 'terra-button';
import 'terra-button/consumer-button-themes.css';

<Button className='consumer-button-default-theme' />
<Button className='consumer-button-concept1-theme' />

Generating Theme CSS

Solution 1: Basic CSS

consumer-button-themes.css

.consumer-button-default-theme {
  --color: #123456
  --terra-button-active-background-color-default: rgb(--color, 0.2);
  --terra-button-active-border-color-default: rgb(--color, 0.5)
  --terra-button-active-color-default: --color;  
  ....(all 34 color variables)
}

.consumer-button-concept1-theme {
  --color: #adsqew
  --terra-button-active-background-color-default: rgb(--color, 0.2);
  --terra-button-active-border-color-default: rgb(--color, 0.5)
  --terra-button-active-color-default: --color;  
  ....
}
......

Obviously, there is a repeating pattern for generating theme classes.

Solution 2: SCSS

$color-map: (
  default: #123456,
  concept1: #qwerty,
  ...
);

@each $color in $color-map {
   .consumer-button-#{$color}-theme {
        --terra-button-active-background-color-default: rgb($color, 0.2);
        --terra-button-active-border-color-default: rgb($color, 0.5)
        --terra-button-active-color-default: $color;  
        ....
   }
}

Solution 3: PostCSS plugin Need to look into that, would be great if you have an idea.

Issue Type

  • New Feature
  • Enhancement
  • Bug
  • Other

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
zhongyncommented, Aug 15, 2017

@mhemesath @alex-bezek how about this:

.consumer-button-theme {
  --color: #123456; 
  --terra-button-active-background-color-default: rgb(var(--color), 0.2);
  --terra-button-active-border-color-default: rgb(var(--color), 0.5)
  --terra-button-active-color-default: var(--color);  
  ....(all 34 color variables)
}

.concept1 { --color: #qwe123; }
.concept2 { --color: #123qwe; }
...
0reactions
bjankordcommented, Nov 30, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Building a Clickable Call-to-Action Button for Your Shopify ...
This tutorial will show how to create a section with a customized call-to-action button that can be included on a landing page.
Read more >
How to Create Custom Buttons - BeTheme
... tutorial will walk you through the steps of creating custom buttons and managing button styles in BeTheme. ... Then Theme Options and...
Read more >
Buttons | UNITED THEMES™
Set your custom button padding in px, em, rem, vw and vh. With these units you can create buttons of every size. Custom...
Read more >
Button Design Guide: How to Design Buttons that Convert
The first step to design buttons that get clicked on is to make them actually look like buttons. Calls to action and sharing...
Read more >
Buttoning things up: How this premium Shopify theme's button ...
Customizable Shopify theme buttons · Other easy to customize buttons · How to use customizable Shopify theme buttons · Adding rounded corners to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found