Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bilal Haidar 144 posts 410 karma points
    Dec 27, 2016 @ 07:50
    Bilal Haidar
    0

    Bootstrap styles are overridden when integrating the button with Fanoe Starter Kit

    Hello,

    I've added this Grid property editor to an existing Umbraco installation having Fanoe starter kit installed.

    Fanoe starter kit does define different css classes for rows (dark, light, etc.)

    I noticed that the style of the button added are overridden by whatever the row has for a style (dark, etc.).

    Is there a way to enforce bootstrap styles no matter what css is used on a website?

    Thanks Bilal

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 27, 2016 @ 10:22
    Rune Hem Strand
    0

    Hi Bilal

    Yeah, Fanoe only uses bootstraps grid/column system. Everything else is custom. Grid CTA Button only outputs for default Bootstrap 3.

    In order to use the Boostrap 3 button colors you need to add the CSS for them. So add something like:

    /* Add Fanoe button styling to btn class */
    a.btn {
        border-radius: 3px;
        padding: 8px 18px !important;
        margin-top: 20px;
        font-family: "Lato", sans-serif !important;
        font-size: 1rem;
        background: transparent;
        transition: all .2s ease-in-out;
    }
    a.btn:hover {
        background: #000;
        color: #fff;
        text-decoration: none !important;
    }
    
    /*Bootstrap 3 btn colors */
    /* Primary */
    .dark .btn.btn-primary,
    .light .btn.btn-primary,
    .blue .btn.btn-primary,
    .yellow .btn.btn-primary,
    .purple .btn.btn-primary {
        background-color: #245580;
        border-color: #245580;
        color: #FFF;
    }
    .dark .btn.btn-primary:hover,
    .light .btn.btn-primary:hover,
    .blue .btn.btn-primary:hover,
    .yellow .btn.btn-primary:hover,
    .blue .btn.btn-primary:hover {
        background-color: #265a88;
        border-color: #265a88;
        color: #FFF
    }
    
    /* Success */
    .dark .btn.btn-success,
    .light .btn.btn-success,
    .blue .btn.btn-success,
    .yellow .btn.btn-success,
    .purple .btn.btn-success {
        background-color: #3e8f3e;
        border-color: #3e8f3e;
        color: #FFF;
    }
    .dark .btn.btn-success:hover,
    .light .btn.btn-success:hover,
    .blue .btn.btn-success:hover,
    .yellow .btn.btn-success:hover,
    .blue .btn.btn-success:hover {
        background-color: #419641;
        border-color: #419641;
        color: #FFF
    }
    
    /* Info */
    .dark .btn.btn-info,
    .light .btn.btn-info,
    .blue .btn.btn-info,
    .yellow .btn.btn-info,
    .purple .btn.btn-info {
        background-color: #28a4c9;
        border-color: #28a4c9;
        color: #FFF;
    }
    .dark .btn.btn-info:hover,
    .light .btn.btn-info:hover,
    .blue .btn.btn-info:hover,
    .yellow .btn.btn-info:hover,
    .blue .btn.btn-info:hover {
        background-color: #2aabd2;
        border-color: #2aabd2;
        color: #FFF
    }
    
    /* Warning */
    .dark .btn.btn-warning,
    .light .btn.btn-warning,
    .blue .btn.btn-warning,
    .yellow .btn.btn-warning,
    .purple .btn.btn-warning {
        background-color: #e38d13;
        border-color: #e38d13;
        color: #FFF;
    }
    .dark .btn.btn-warning:hover,
    .light .btn.btn-warning:hover,
    .blue .btn.btn-warning:hover,
    .yellow .btn.btn-warning:hover,
    .blue .btn.btn-warning:hover {
        background-color: #eb9316;
        border-color: #eb9316
        color: #FFF
    }
    
    /* Danger */
    .dark .btn.btn-danger,
    .light .btn.btn-danger,
    .blue .btn.btn-danger,
    .yellow .btn.btn-danger,
    .purple .btn.btn-danger {
        background-color: #b92c28;
        border-color: #b92c28;
        color: #FFF;
    }
    .dark .btn.btn-danger:hover,
    .light .btn.btn-danger:hover,
    .blue .btn.btn-danger:hover,
    .yellow .btn.btn-danger:hover,
    .blue .btn.btn-danger:hover {
        background-color: #c12e2a;
        border-color: #c12e2a;
        color: #FFF
    }
    

    The colors don't don't really match up with Fanoes styling to well but that can easily be changed in the css :)

    All the best
    Rune

  • Bilal Haidar 144 posts 410 karma points
    Dec 27, 2016 @ 10:26
    Bilal Haidar
    0

    Hi Rune,

    By adding the above, I've changed the Fanoe theme. I am thinking of a more generic solution so that wherever I place the button (CTAButton), it will take the default Bootstrap 3 styles.

    One possible solution I am thinking of is to include all .btn, .btn-primary, etc. classes that ship with bootstrap and place them in a custom.css file and add !important to each and every single css. Is that ok?

    Thanks, Bilal

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 27, 2016 @ 10:54
    Rune Hem Strand
    100

    The above css shouldn't really be overriding anything, it just adds the btn classes from Bootstrap. They don't exist in Fanoe, so wether you add them to the one of the existing stylesheets or create a new one is up to you. Adding them separately means that you don't have to worry about overwriting fanoe.css when upgrading, so that's actually a good idea. Creating links and button with Fanoes button class will work like it always did.

    Your approach will also work, however adding all those !important's seems a bit much. I would still go for adding the theme color classes (dark, light, yelow etc.) to bootstraps button styling instead.

    /Rune

  • Bilal Haidar 144 posts 410 karma points
    Dec 27, 2016 @ 11:10
    Bilal Haidar
    0

    Yes, now it makes more sense to me.

    So, I can get all related classes from Bootstrap (normal state, hover, focus, etc.) and prefix them with .dark, .light, etc.

    Actually, I am thinking of adding this to the CtaButton editor :-) Maybe the editor might specify the prefix class to add, then some magic behind the scenes, some css would be generated. Just an idea, i will think more of how to implement this.

    Thanks Rune :)

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 27, 2016 @ 11:30
    Rune Hem Strand
    0

    Yes! There is definitely a lot that can be done to make it more clever :)

    I do think the best thing is to add classes to whatever output you want it to generate and then having styling in site specific CSS (be it framework or custom code). I'm not a fan of injecting CSS on a site from a package as that easily generates conflicts, where either the site or the package CSS will get overwritten.

    In a perfect world it wouldn't even be targeting Bootstrap OTB 3 but instead be super easy to configure to use any framework and/or custom classes.

    You are more than welcome to do a pull request if you come up with something, raise issues/feature request on the tracker or post it here on the forum for further discussion.

  • Bilal Haidar 144 posts 410 karma points
    Dec 27, 2016 @ 11:34
    Bilal Haidar
    0

    Thanks Rune, I will work on something and share of course.

    I have some background experience in Wordpress. There, there is a widget created by SiteOrigin (https://siteorigin.com/widgets-bundle/button-widget-documentation/). I find it really useful to use in Websites.

    The idea came to my mind why not have something similar and even better in Umbraco as I am sure this is needed when non-technical editors are involved.

    I will keep you posted.

    Regards Bilal

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 27, 2016 @ 11:38
    Rune Hem Strand
    1

    That is a great example! Definitely food for thought. I really like the ability to add icons to the button :) Thanks for sharing that!

  • Bilal Haidar 144 posts 410 karma points
    Dec 27, 2016 @ 12:45
    Bilal Haidar
    0

    Exactly what I was talking about: http://www.chriscraft.com/articles/macro-button/

    /Bilal

  • Rune Hem Strand 147 posts 911 karma points hq c-trib
    Dec 27, 2016 @ 13:43
    Rune Hem Strand
    0

    Oh nice :)

  • Bilal Haidar 144 posts 410 karma points
    Dec 27, 2016 @ 13:58
    Bilal Haidar
    0

    I will try to recreate something similar based on your editor. This editor I believe is not open source, so no access to its code.

    I will keep you posted.

    /Bilal

Please Sign in or register to post replies

Write your reply to:

Draft