mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 17:07:36 -02:30
Convert toolbar button components to styled-components.
This commit is contained in:
@@ -96,7 +96,7 @@ class DataListToolbar extends React.Component {
|
|||||||
)}
|
)}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</LevelItem>
|
</LevelItem>
|
||||||
<LevelItem>
|
<LevelItem css="display: flex;">
|
||||||
{additionalControls}
|
{additionalControls}
|
||||||
</LevelItem>
|
</LevelItem>
|
||||||
</Level>
|
</Level>
|
||||||
|
|||||||
@@ -66,49 +66,49 @@
|
|||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.awx-toolbar .pf-c-button.pf-m-primary {
|
// .awx-toolbar .pf-c-button.pf-m-primary {
|
||||||
background-color: #5cb85c;
|
// background-color: #5cb85c;
|
||||||
min-width: 0px;
|
// min-width: 0px;
|
||||||
width: 30px;
|
// width: 30px;
|
||||||
height: 30px;
|
// height: 30px;
|
||||||
text-align: center;
|
// text-align: center;
|
||||||
padding: 0px;
|
// padding: 0px;
|
||||||
margin: 0px;
|
// margin: 0px;
|
||||||
margin-right: 20px;
|
// margin-right: 20px;
|
||||||
}
|
// }
|
||||||
|
|
||||||
.awx-toolbar .pf-l-toolbar__item .pf-c-button.pf-m-plain {
|
.awx-toolbar .pf-l-toolbar__item .pf-c-button.pf-m-plain {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.awx-ToolBarBtn {
|
// .awx-ToolBarBtn {
|
||||||
width: 30px;
|
// width: 30px;
|
||||||
display: flex;
|
// display: flex;
|
||||||
justify-content: center;
|
// justify-content: center;
|
||||||
margin-right: 20px;
|
// margin-right: 20px;
|
||||||
border-radius: 3px;
|
// border-radius: 3px;
|
||||||
|
|
||||||
&[disabled] {
|
// &[disabled] {
|
||||||
cursor: not-allowed;
|
// cursor: not-allowed;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
.awx-ToolBarBtn:hover {
|
// .awx-ToolBarBtn:hover {
|
||||||
.awx-ToolBarTrashCanIcon {
|
// .awx-ToolBarTrashCanIcon {
|
||||||
color: white;
|
// color: white;
|
||||||
}
|
// }
|
||||||
background-color:#d9534f;
|
// background-color:#d9534f;
|
||||||
}
|
// }
|
||||||
|
|
||||||
.awx-ToolBarBtn[disabled]:hover {
|
// .awx-ToolBarBtn[disabled]:hover {
|
||||||
.awx-ToolBarTrashCanIcon {
|
// .awx-ToolBarTrashCanIcon {
|
||||||
color: #d2d2d2;
|
// color: #d2d2d2;
|
||||||
}
|
// }
|
||||||
background-color: white;
|
// background-color: white;
|
||||||
}
|
// }
|
||||||
|
|
||||||
.pf-l-toolbar > div {
|
// .pf-l-toolbar > div {
|
||||||
&:last-child{
|
// &:last-child{
|
||||||
display:none;
|
// display:none;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@@ -1,10 +1,24 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { string, func } from 'prop-types';
|
import { string, func } from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Button } from '@patternfly/react-core';
|
import { Button as PFButton } from '@patternfly/react-core';
|
||||||
import { PlusIcon } from '@patternfly/react-icons';
|
import { PlusIcon } from '@patternfly/react-icons';
|
||||||
import { I18n } from '@lingui/react';
|
import { I18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Button = styled(PFButton)`
|
||||||
|
&&& { /* higher specificity order */
|
||||||
|
background-color: #5cb85c;
|
||||||
|
min-width: 0;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
function ToolbarAddButton ({ linkTo, onClick }) {
|
function ToolbarAddButton ({ linkTo, onClick }) {
|
||||||
if (!linkTo && !onClick) {
|
if (!linkTo && !onClick) {
|
||||||
@@ -15,7 +29,7 @@ function ToolbarAddButton ({ linkTo, onClick }) {
|
|||||||
return (
|
return (
|
||||||
<I18n>
|
<I18n>
|
||||||
{({ i18n }) => (
|
{({ i18n }) => (
|
||||||
<Link to={linkTo} className="pf-c-button pf-m-primary">
|
<Link to={linkTo}>
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
aria-label={i18n._(t`Add`)}
|
aria-label={i18n._(t`Add`)}
|
||||||
|
|||||||
@@ -1,12 +1,41 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import { func, bool, number, string, arrayOf, shape } from 'prop-types';
|
import { func, bool, number, string, arrayOf, shape } from 'prop-types';
|
||||||
import { Button, Tooltip } from '@patternfly/react-core';
|
import { Button as PFButton, Tooltip } from '@patternfly/react-core';
|
||||||
import { TrashAltIcon } from '@patternfly/react-icons';
|
import { TrashAltIcon } from '@patternfly/react-icons';
|
||||||
import { I18n, i18nMark } from '@lingui/react';
|
import { I18n, i18nMark } from '@lingui/react';
|
||||||
import { Trans, t } from '@lingui/macro';
|
import { Trans, t } from '@lingui/macro';
|
||||||
|
import styled from 'styled-components';
|
||||||
import AlertModal from '../AlertModal';
|
import AlertModal from '../AlertModal';
|
||||||
import { pluralize } from '../../util/strings';
|
import { pluralize } from '../../util/strings';
|
||||||
|
|
||||||
|
const Button = styled(PFButton)`
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-right: 20px;
|
||||||
|
border-radius: 3px;
|
||||||
|
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
&:hover {
|
||||||
|
background-color: white;
|
||||||
|
|
||||||
|
> svg {
|
||||||
|
color: #d2d2d2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color:#d9534f;
|
||||||
|
> svg {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const ItemToDelete = shape({
|
const ItemToDelete = shape({
|
||||||
id: number.isRequired,
|
id: number.isRequired,
|
||||||
name: string.isRequired,
|
name: string.isRequired,
|
||||||
@@ -102,13 +131,12 @@ class ToolbarDeleteButton extends React.Component {
|
|||||||
position="left"
|
position="left"
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
className="awx-ToolBarBtn"
|
|
||||||
variant="plain"
|
variant="plain"
|
||||||
aria-label={i18n._(t`Delete`)}
|
aria-label={i18n._(t`Delete`)}
|
||||||
onClick={this.handleConfirmDelete}
|
onClick={this.handleConfirmDelete}
|
||||||
isDisabled={isDisabled}
|
isDisabled={isDisabled}
|
||||||
>
|
>
|
||||||
<TrashAltIcon className="awx-ToolBarTrashCanIcon" />
|
<TrashAltIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
{ isModalOpen && (
|
{ isModalOpen && (
|
||||||
|
|||||||
Reference in New Issue
Block a user