mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 08:57:35 -02:30
add omitProps helper
This commit is contained in:
@@ -3,6 +3,7 @@ import { bool, string } from 'prop-types';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Button } from '@patternfly/react-core';
|
import { Button } from '@patternfly/react-core';
|
||||||
import { AngleRightIcon } from '@patternfly/react-icons';
|
import { AngleRightIcon } from '@patternfly/react-icons';
|
||||||
|
import omitProps from '@util/omitProps';
|
||||||
import ExpandingContainer from './ExpandingContainer';
|
import ExpandingContainer from './ExpandingContainer';
|
||||||
|
|
||||||
const Toggle = styled.div`
|
const Toggle = styled.div`
|
||||||
@@ -17,12 +18,12 @@ const Toggle = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Arrow = styled(AngleRightIcon)`
|
const Arrow = styled(omitProps(AngleRightIcon, 'isExpanded'))`
|
||||||
margin-right: -5px;
|
margin-right: -5px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
transition: transform 0.1s ease-out;
|
transition: transform 0.1s ease-out;
|
||||||
transform-origin: 50% 50%;
|
transform-origin: 50% 50%;
|
||||||
${(props) => props.isExpanded && `transform: rotate(90deg);`}
|
${props => props.isExpanded && `transform: rotate(90deg);`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function CollapsibleSection({ label, startExpanded, children }) {
|
function CollapsibleSection({ label, startExpanded, children }) {
|
||||||
|
|||||||
11
awx/ui_next/src/util/omitProps.jsx
Normal file
11
awx/ui_next/src/util/omitProps.jsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function omitProps(Component, ...omit) {
|
||||||
|
return function Omit(props) {
|
||||||
|
const clean = { ...props };
|
||||||
|
omit.forEach(key => {
|
||||||
|
delete clean[key];
|
||||||
|
})
|
||||||
|
return <Component {...clean} />;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user