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.

Angular theme suport

See original GitHub issue

** Which Category is your question related to? ** aws-amplify-angular v2.1.6

** What AWS Services are you utilizing? ** aws-amplify-angular / Cognito

** Provide additional details e.g. code snippets ** I’m just trying to figure out if theme support is there for Angular. React seems to have a ton of support for themes, but Angular seems to have no love.

Getting down to the core, after importing Theme.css it pretty much horks up my entire application’s theme:

@import '~aws-amplify-angular/Theme.css';

Should I just be rolling my own here? Or am I just missing something?

Appreciate any help. Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
kernwigcommented, Aug 31, 2019

After some experimentation, I found that adding this to my app’s style.scss properly applied the Amplify theme isolated to only where needed:

@import "~@aws-amplify/ui/src/Theme.css";
.amplify-block {
    @import "~@aws-amplify/ui/src/Angular";

    .amplify-container {
        padding-bottom: 2em;
    }
}

Basic usage:

        <div class="amplify-block">
            <amplify-authenticator></amplify-authenticator>
        </div>

The padding-bottom applies some padding to the sign-in/sign-up form under the buttons, which seems like a bug too.

2reactions
LucasRouckhoutcommented, Feb 24, 2019

I had the same issue. I’m building an Angular app and using the <amplify-authenticator> and when importing the styling it completely screws up the rest of my styling.

A quick look in the actual CSS reveals why this is so. ~aws-amplify-angular/Theme.css' actually contains three other imports:

@import "~@aws-amplify/ui/src/Theme.css";
@import "~@aws-amplify/ui/src/Angular.css";
@import "~@aws-amplify/ui/dist/style.css";

It is the Angular one that contains most of the irritating css.

...
h1 {
  height: 50px;
  font-weight: 500;
}

h2 {
  height: 42px;
  font-weight: 300;
}

h4 {
  height: 28px;
  font-weight: 400;
}

h5 {
  height: 21px;
  font-weight: 400;
}

p {
  height: 16px;
  font-weight: 300;
}
...

So what I did as a workaround was copying the css that I needed from these files, which would be the authenticator, forms and input groups css, and put it in my styles.css. It clutters up your styles.css a bit but you can remove the unwanted styling and change the parts you want.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Theming Angular Material
Defining multiple themes in a single file allows you to support multiple themes without having to manage loading of multiple CSS assets.
Read more >
How to create themes for your Angular 7 apps using CSS ...
In this post, we will build a super simple cryptocurrency listing app using Angular 7 and CSS variables.
Read more >
Angular Material Theming System - Complete Guide
After adding support for multiple themes, we will learn how to apply Angular Material's theming to custom components. We will take an example...
Read more >
Theme support with Angular Material | nerd.vision
This included theme support, better test coverage and responsive design. Today I wanted to talk about how we implemented theming with Angular ......
Read more >
The complete guide to Angular Material Themes - Tomas Trajan
Theming support in an application can be pretty useful. From nice to have feature like letting user to chose from available color schemes...
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