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 2 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
8 changes: 7 additions & 1 deletion 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-duration: 80ms;
}

// 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 Expand Up @@ -146,7 +152,7 @@
.@{table-prefix-cls} {
color: inherit;

* {
tr, th, td {
transition: none !important;
}

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