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

Fix dynamic input group buttons #3273

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion frontend/src/js/button/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const SxBasicButton = styled(BasicButton)<{
opacity: 1;

background-color: ${({ frame, bgHover, theme }) =>
frame || bgHover ? theme.col.grayVeryLight : " inherit"};
frame || bgHover ? theme.col.bgAlt : " inherit"};
}

&:disabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ const DropzoneList = <DroppableObject extends PossibleDroppableObject>(
/>
)}
<ListItem>
<StyledIconButton icon={faTimes} onClick={() => onDelete(i)} />
<StyledIconButton
bgHover
icon={faTimes}
onClick={() => onDelete(i)}
/>
{item}
</ListItem>
</ConceptContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,25 @@ interface PropsT {
}

const Container = styled.div`
padding: 4px;
display: flex;
flex-wrap: wrap;
gap: 8px;
`;

const AddBtn = styled(IconButton)``;

const RemoveBtn = styled(IconButton)`
position: absolute;
top: -5px;
top: -7px;
right: -7px;
opacity: 1;
z-index: 1;
background-color: white;
`;

const GroupItem = styled("div")`
padding: 2px 2px 2px 0;
position: relative;
margin: 0 5px 5px 0;
max-width: 200px;
`;

const DynamicInputGroup = ({
Expand Down Expand Up @@ -59,11 +61,18 @@ const DynamicInputGroup = ({
you can also just delete the following constraint:
*/}
{limit !== 1 && (
<RemoveBtn tiny icon={faTimes} onClick={() => onRemoveClick(idx)} />
<RemoveBtn
bgHover
tiny
icon={faTimes}
onClick={() => onRemoveClick(idx)}
/>
)}
</GroupItem>
))}
{limitNotReached && <AddBtn icon={faPlus} tiny onClick={onAddClick} />}
{limitNotReached && (
<IconButton bgHover icon={faPlus} tiny onClick={onAddClick} />
)}
</Container>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ interface Props {
rowPrefixFieldname?: string;
}

const DropzoneListItem = styled("div")``;

const Row = styled("div")`
display: flex;
align-items: center;
Expand Down Expand Up @@ -316,7 +314,7 @@ const FormConceptGroup = (props: Props) => {
);
}}
items={props.value.map((row, i) => (
<DropzoneListItem>
<div>
{props.renderRowPrefix
? props.renderRowPrefix({
value: props.value,
Expand Down Expand Up @@ -459,7 +457,7 @@ const FormConceptGroup = (props: Props) => {
),
)}
/>
</DropzoneListItem>
</div>
))}
/>
{isCopyModalOpen && (
Expand Down
Loading