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

Update form text colors #3296

Merged
merged 8 commits into from
Jan 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 19 additions & 29 deletions client/app/assets/less/ant.less
Original file line number Diff line number Diff line change
@@ -1,33 +1,23 @@
@import '~antd/lib/style/core/iconfont.less';
@import '~antd/lib/style/core/motion.less';
@import '~antd/lib/input/style/index.less';
@import '~antd/lib/input-number/style/index.less';
@import '~antd/lib/date-picker/style/index.less';
@import '~antd/lib/modal/style/index.less';
@import '~antd/lib/tooltip/style/index.less';
@import '~antd/lib/select/style/index.less';
@import '~antd/lib/checkbox/style/index.less';
@import '~antd/lib/upload/style/index.less';
@import '~antd/lib/form/style/index.less';
@import '~antd/lib/button/style/index.less';
@import '~antd/lib/radio/style/index.less';
@import '~antd/lib/time-picker/style/index.less';
@import '~antd/lib/style/core/iconfont';
@import '~antd/lib/style/core/motion';
@import '~antd/lib/input/style/index';
@import '~antd/lib/input-number/style/index';
@import '~antd/lib/date-picker/style/index';
@import '~antd/lib/modal/style/index';
@import '~antd/lib/tooltip/style/index';
@import '~antd/lib/select/style/index';
@import '~antd/lib/checkbox/style/index';
@import '~antd/lib/upload/style/index';
@import '~antd/lib/form/style/index';
@import '~antd/lib/button/style/index';
@import '~antd/lib/radio/style/index';
@import '~antd/lib/time-picker/style/index';
@import 'inc/ant-variables';

// Overwritting Ant Design defaults to fit into Redash current style
@redash-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

@font-family-no-number : @redash-font;
@font-family : @redash-font;
@code-family : @redash-font;
@font-size-base : 13px;
@text-color : #767676;

@input-height-base : 35px;
@input-color : #9E9E9E;
@border-radius-base : 2px;
@border-color-base : #e8e8e8;

@primary-color : #2196F3;
// Remove bold in labels for Ant checkboxes and radio buttons
.ant-checkbox-wrapper, .ant-radio-wrapper {
font-weight: normal;
}

// Fix for disabled button styles inside Tooltip component.
// Tooltip wraps disabled buttons with `<span>` and moves all styles
Expand Down
29 changes: 29 additions & 0 deletions client/app/assets/less/inc/ant-variables.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* --------------------------------------------------------
Colors
-----------------------------------------------------------*/
@primary-color: #2196F3;


/* --------------------------------------------------------
Font
-----------------------------------------------------------*/
@redash-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
Copy link
Member Author

Choose a reason for hiding this comment

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

loooong line...

@font-family-no-number: @redash-font;
@font-family: @redash-font;
@code-family: @redash-font;
@font-size-base: 13px;


/* --------------------------------------------------------
Typograpgy
-----------------------------------------------------------*/
@text-color: #595959;
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't find a place where this is noticeable (lmk if you see this anywhere), but this creates a slight difference between @text-color for Ant styling and for the rest (#595959 vs #767676).

I changed this color because it seemed better for Ant Checkbox labels and Buttons:

Before
checkbox-before
After
checkbox-after 1

It's probably better to pick one of those and set in both scopes, but I let this open for discussion 🙂

Copy link
Contributor

Choose a reason for hiding this comment

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

#595959 looks more suitable to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

@gabrieldutra I've noticed form labels have font-weight: 500 which doesn't look suitable for checkbox and radio button labels (like in this screenshot). Doesn't look like it's an Ant style. Do you know what's causing this?

Copy link
Member Author

@gabrieldutra gabrieldutra Jan 17, 2019

Choose a reason for hiding this comment

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

Both of these are the wrongdoers 🙂:

// inc/form.less 
label {
    font-weight: 500;
}

// ~bootstrap/less/forms.less
label {
  display: inline-block;
  max-width: 100%; // Force IE8 to wrap long content (see https://github.com/twbs/bootstrap/issues/13141)
  margin-bottom: 5px;
  font-weight: bold; // <- This
}

Copy link
Member Author

@gabrieldutra gabrieldutra Jan 17, 2019

Choose a reason for hiding this comment

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

Replacing the first label selector with font-weight: normal fixes this. (and also affects all form labels 😂)



/* --------------------------------------------------------
Form
-----------------------------------------------------------*/
@input-height-base: 35px;
@input-color: #595959;
@border-radius-base: 2px;
@border-color-base: #E8E8E8;
2 changes: 1 addition & 1 deletion client/app/assets/less/inc/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/* --------------------------------------------------------
Form
-----------------------------------------------------------*/
@input-color: #9E9E9E;
@input-color: #595959;
@input-color-placeholder: #b4b4b4;
@input-border: #e8e8e8;
@input-border-radius: 0;
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/data-source/create_data_source_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ describe('Create Data Source', () => {
cy.getByTestId('Database Name').type('postgres{enter}');

cy.contains('Saved.');
cy.percySnapshot('Create Data Source page');
Copy link
Member

Choose a reason for hiding this comment

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

😍

});
});