mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 20:30:46 -03:30
add omitProps helper
This commit is contained in:
parent
8a31be6ffe
commit
3a9a884bbc
@ -3,6 +3,7 @@ import { bool, string } from 'prop-types';
|
||||
import styled from 'styled-components';
|
||||
import { Button } from '@patternfly/react-core';
|
||||
import { AngleRightIcon } from '@patternfly/react-icons';
|
||||
import omitProps from '@util/omitProps';
|
||||
import ExpandingContainer from './ExpandingContainer';
|
||||
|
||||
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-left: 5px;
|
||||
transition: transform 0.1s ease-out;
|
||||
transform-origin: 50% 50%;
|
||||
${(props) => props.isExpanded && `transform: rotate(90deg);`}
|
||||
${props => props.isExpanded && `transform: rotate(90deg);`}
|
||||
`;
|
||||
|
||||
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} />;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user