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

Use Ant's Button component on users list page #3416

Merged
merged 4 commits into from
Feb 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions client/app/assets/less/ant.less
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
z-index: 1050;
}

// Button overrides

.@{btn-prefix-cls} {
transition: none;
Copy link
Contributor

@ranbena ranbena Feb 8, 2019

Choose a reason for hiding this comment

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

What's this for?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah the transition is a bit slow.
I propose this instead:

transition-duration: 150ms;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ranbena 80-90ms feels more comfortable imo. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

For me 100 was too fast, 200ms too slow, 150 sweet spot

Copy link
Contributor

Choose a reason for hiding this comment

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

"too fast" as in meaningless

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ranbena Tried once more, and seems you're right - 150ms is better 🤔 Changed it again

Copy link
Contributor

Choose a reason for hiding this comment

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

perfection1

Copy link
Member

Choose a reason for hiding this comment

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

Is it possible there is a difference between MacOS and Linux?

I remember feeling Ant's animation are slow, while for Levko they were fine. Maybe something similar happens here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's just different perception

Copy link
Contributor

Choose a reason for hiding this comment

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

There might be something to @arikfr's idea though. I had a similar though about some animations that @ranbena used in his new dashboard parameters UI. Might be interesting to double check.

}

// Fix ant input number showing duplicate arrows
.ant-input-number-input::-webkit-outer-spin-button,
.ant-input-number-input::-webkit-inner-spin-button {
Expand Down
10 changes: 7 additions & 3 deletions client/app/assets/less/inc/ant-variables.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* --------------------------------------------------------
Colors
-----------------------------------------------------------*/

@lightblue: #03A9F4;
@primary-color: #2196F3;

Expand Down Expand Up @@ -36,9 +35,15 @@


/* --------------------------------------------------------
Pagination
Button
-----------------------------------------------------------*/
@btn-danger-bg: fade(@redash-gray, 10%);
@btn-danger-border: fade(@redash-gray, 15%);


/* --------------------------------------------------------
Pagination
-----------------------------------------------------------*/
@pagination-item-size: 33px;
@pagination-font-family: @redash-font;
@pagination-font-weight-active: normal;
Expand All @@ -55,7 +60,6 @@
/* --------------------------------------------------------
Table
-----------------------------------------------------------*/

@table-border-radius-base: 0;
@table-header-color: #333;
@table-header-bg: fade(@redash-gray, 3%);
Expand Down
17 changes: 7 additions & 10 deletions client/app/pages/users/UsersList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { map } from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { react2angular } from 'react2angular';
import classNames from 'classnames';

import Button from 'antd/lib/button';
import { Paginator } from '@/components/Paginator';
import DynamicComponent from '@/components/DynamicComponent';

Expand All @@ -27,13 +27,13 @@ function UsersListActions({ user, actions }) {
const { enableUser, disableUser, deleteUser } = actions;
if (user.is_invitation_pending) {
return (
<button type="button" className="btn btn-default btn-block" onClick={event => deleteUser(event, user)}>Delete</button>
<Button type="danger" className="w-100" onClick={event => deleteUser(event, user)} htmlType="button">Delete</Button>
);
}
return user.is_disabled ? (
<button type="button" className="btn btn-primary btn-block" onClick={event => enableUser(event, user)}>Enable</button>
<Button type="primary" className="w-100" onClick={event => enableUser(event, user)} htmlType="button">Enable</Button>
) : (
<button type="button" className="btn btn-default btn-block" onClick={event => disableUser(event, user)}>Disable</button>
<Button className="w-100" onClick={event => disableUser(event, user)} htmlType="button">Disable</Button>
);
}

Expand Down Expand Up @@ -120,14 +120,11 @@ class UsersList extends React.Component {
return null;
}
return (
<div className="m-b-10">
<a
href="users/new"
className={classNames('btn', 'btn-default', 'm-b-10', { disabled: !policy.isCreateUserEnabled() })}
>
<div className="m-b-15">
<Button type="primary" disabled={!policy.isCreateUserEnabled()} href="users/new" htmlType="button">
<i className="fa fa-plus m-r-5" />
New User
</a>
</Button>
<DynamicComponent name="UsersListExtra" />
</div>
);
Expand Down