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

Make CSS in Web engine independent from main application #2

Conversation

kristinalim
Copy link

What? Why?

Make CSS in the Web engine independent from CSS in the main application.

This is the gist of the approach:

darkswarm/all.scss:

@include "../web/all.scss";

branding.scss:

$ofn-web-cookies-banner-background-color: $dark-grey;

web/base/colors.scss:

$ofn-web-cookies-banner-background-color: #fff !default;

web/all.scss:

@import 'web/base/colors';
@import 'web/pages/cookies_banner;

See discussion here.

What should we test?

Test that the CSS for the following are still properly applied:

  • Cookies Banner
  • Cookies Policy Modal

Dependencies

The base branch for this PR is the branch for this pull request.

.cookies-banner {
background: $dark-grey;
background: $ofn-web-cookies-banner-background-color;
Copy link
Owner

@luisramos0 luisramos0 Sep 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kristinalim awesome, looks great. I agree, this is much better. I am pretty sure we will use this approach.

My only doubt is in this commit. 3 questions:

  • are these new variables ($ofn-web-cookies-banner-text-color) necessary to make this approach work? I havent tested, but it looks like that it would still work with the original "background: $dark-grey;"
  • is this something you think is better than the easier "background: $dark-grey;"? I understand it makes it possible to change colours in only one place but it looks a bit complicated...
  • there is a 3rd option which is to use the variables but have them defined only in web/base/colors.css.scss like it's done here on the darkswarm/branding.css.scss, correct? If this is correct, I think this would be my preferred approach. Also because in the end I dont think there will be any main-app CSS, it will all be in some specific domain, for example, web. For example, if shop or checkout domains depend on Web for CSS, I'd expect the "Place your order" button to be configured in the checkout domain css, not the web domain.

I hope my questions this makes sense :-)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luisramos0 For Items 1 and 2, my intention in doing it this way was to extract a color palette and to make the colors easy to manage (review and change). My reasons behind preferring this approach:

  1. If site-wide we were to make a general theme change where this dark grey is changed to dark green, should we change all places where we use this variable name?
  2. What do we name another shade between $med-drk-grey and $dark-grey? We already have these names? 👇 Having the usages described in one file would at least make it less confusing.
app/assets/stylesheets/darkswarm/branding.css.scss:5:$ofn-grey: #808184;
app/assets/stylesheets/darkswarm/branding.css.scss:34:$med-grey: #666;
app/assets/stylesheets/darkswarm/branding.css.scss:35:$med-drk-grey: #444;
app/assets/stylesheets/darkswarm/branding.css.scss:36:$dark-grey: #333;
app/assets/stylesheets/darkswarm/branding.css.scss:37:$light-grey: #ddd;
  1. How hard will it be to change colors in the website?

Even if there was no plan to change colors, I think it's good practice. And not too complicated IMO, just declaring color assignments in another file. 🙂

For Item 3, I'm okay with that. 🙂 There will be some duplication among the domain engines, but they're supposed to work independently anyway.

Let me know what you think, then I will update this PR.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that makes total sense, lets do it. But I think we need to separate objectives.
Moving files to /pages and improving color palette should be done on the master branch.

I want to keep the engines poc as close to master as possible.
So, all I'd like to put in it is this commit:
34562c5

Everything else makes total sense but I'd like to see it in master first. Do you want to create a PR in master with that? or I can do it... in a few days.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, they're separate objectives. Feel free to cherry-pick what's needed and then close this PR. I will create the PR... in a few days. 🙂

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, thanks. I'll do it today actually. I'll do the cherry picking and create the 2 PRs against master (/pages and colour management). Thanks a lot!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all right, done, see here:
openfoodfoundation#2521 (comment)
now, I'll create the PR in master with the colour palete part!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here's the colors PR in master: openfoodfoundation#2735

@luisramos0 luisramos0 force-pushed the cookies_in_engine branch 8 times, most recently from 9e493a4 to c22ac00 Compare September 17, 2018 15:28
@luisramos0
Copy link
Owner

Closing this PR for now. We have 2521 for engines and #2735 for colors.

@luisramos0 luisramos0 closed this Sep 17, 2018
luisramos0 pushed a commit that referenced this pull request Apr 9, 2020
…cker

Re-add setup instructions removed from docker-compose into Dockerfile…
luisramos0 pushed a commit that referenced this pull request Jul 24, 2021
…ce7b1a99a13ab

parent b680697
author Nihal Mohammed <[email protected]> 1621004464 +0530
committer Nihal Mohammed <[email protected]> 1621022463 +0530

# This is a combination of 4 commits.
# This is the 1st commit message:

Add advanced settings button to incoming and outgoing pages in OC cycle edit

# This is the commit message #2:

Remove extra header text

# This is the commit message #3:

Moved repeating code blocks to partial

# This is the commit message #4:

Refactored code

# This is the commit message #5:

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

Successfully merging this pull request may close these issues.

2 participants