Skip to content
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

Add optional logo setting #75

Closed
bradfrost opened this issue Oct 1, 2017 · 11 comments
Closed

Add optional logo setting #75

bradfrost opened this issue Oct 1, 2017 · 11 comments
Assignees

Comments

@bradfrost
Copy link
Member

Have the ability to add a company's logo to the Pattern Lab interface. I already have the style and markup in place; I just need to know how to make it a variable inside of patternlab-config.json (which maybe @bmuenzenmeyer could walk me through?).

I'm thinking something like this in the markup:

{{# logoImage }}
    <div class="pl-c-logo">
        <img class="pl-c-logo__img" src="{{ logoImage }}" />
    </div><!--end pl-c-logo-->
    {{/ logoImage }}

and this in patternlab-config.json:

{
    "logoImage" : "path/to/image.svg"
}

Understanding how config variables work in general would help me with all the theming stuff I'm doing.

@bradfrost bradfrost self-assigned this Oct 1, 2017
@bmuenzenmeyer
Copy link
Member

bmuenzenmeyer commented Oct 1, 2017

This function within Pattern Lab core is most directly responsible for outputting JSON available to the front end.

https://github.com/pattern-lab/patternlab-node/blob/master/core/lib/ui_builder.js#L570

You will notice a couple objects in there that may look familiar to you, such as ishControls navItems patternPaths etc

This function takes patternlab as an object, which also has the config attached to it.

If you added logoImage onto patternlab-config.json it would be available as patternlab.config.logoImage

I think what we could do is put logoImage inside an object called theme, and then I can pass the entire thing back to the client?

I can hack that together pretty quick, and patternlab-config.json would look like:

{
  "theme" : {
     "logoImage" : "path/to/image.jpg" //which may have to be creatively relative, btw
     ...
   }
}

The nice thing about wrapping it into something like this is that I can pass the whole thing and reasonable future proof it for you.

@bmuenzenmeyer
Copy link
Member

that work for you @bradfrost ?

@bmuenzenmeyer
Copy link
Member

bmuenzenmeyer commented Oct 1, 2017

@bradfrost
Copy link
Member Author

bradfrost commented Oct 1, 2017

Thanks @bmuenzenmeyer! I think that theme object is exactly what we're looking for. Here's just a few things I'm thinking for that object:

{
  "theme" : {
    "logoImage" : false | "path/to/file",
    "color" : "dark" | "light" | [future color themes],
    "custom" : false | "path/to/custom/theme/css",
    "density" : "compact" | "cozy" | "comfortable",
    "layout" : "horizontal" | "vertical",
    "mode" : "workshop" | "storefront"
  }
}

All of the default values for the above object come first, as this is what is the current PL setup. Most of the other theme parameters I've either started on or have completed. And for the mode part, the thought is to be able to use PL as both a workshop and a storefront, so it can be used by the working team to build the design system, and then elegantly serve as a styleguide at the same time. It would be cool to be able to build simultaneously to two different places with each mode selected.

@bmuenzenmeyer
Copy link
Member

bmuenzenmeyer commented Oct 1, 2017 via email

@bmuenzenmeyer
Copy link
Member

bmuenzenmeyer commented Oct 1, 2017 via email

@bradfrost
Copy link
Member Author

bradfrost commented Oct 1, 2017 via email

@maxleistner
Copy link

Is this still a thing? I tried it with the new Node 3.0 version, but it does not work. The PL logo is still present. :) Thanks!

"theme": {
    "color": "light",
    "density": "compact",
    "layout": "vertical",
    "noViewAll": false,
    "logoImage": "../logo.jpg"
  },

@bmuenzenmeyer
Copy link
Member

@sghoweri I know name is... I'm trying to recall what new stuff has cooked up

@bmuenzenmeyer
Copy link
Member

@bmuenzenmeyer
Copy link
Member

Closed via pattern-lab/patternlab-node#1078

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

No branches or pull requests

3 participants