Skip to content

Commit

Permalink
Merge pull request #1986 from SpareBank1/develop_fix-task-button
Browse files Browse the repository at this point in the history
Develop fix task button
  • Loading branch information
pethel authored May 7, 2024
2 parents 596141d + 6b48aa9 commit 728cda7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
11 changes: 9 additions & 2 deletions packages/ffe-buttons-react/src/TaskButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ describe('<TaskButton />', () => {

it('sends icon prop on as leftIcon prop', () => {
renderTaskButton({
icon: <Icon ariaLabel="icon" fileUrl="fileUrl" size="md" />,
icon: (
<Icon
ariaLabel="icon"
fileUrl="fileUrl"
size="md"
data-testid="icon"
/>
),
});
const icon = screen.getByRole('img');
const icon = screen.getByTestId('icon');
expect(icon.getAttribute('style')).toContain('fileUrl');
});
});
9 changes: 6 additions & 3 deletions packages/ffe-buttons-react/src/TaskButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ function TaskButtonWithForwardRef<As extends ElementType>(
props: TaskButtonProps<As>,
ref: ForwardedRef<any>,
) {
const propWithRef = { ...props, ref };
const { icon, ...rest } = propWithRef;

return (
<BaseButton
leftIcon={props.icon}
{...props}
ref={ref}
leftIcon={<div aria-hidden="true">{icon}</div>}
{...rest}
ref={propWithRef.ref}
buttonType="task"
/>
);
Expand Down
1 change: 1 addition & 0 deletions packages/ffe-buttons/less/base-button.less
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
width: auto;

.ffe-button__icon > .ffe-icons {
display: block;
color: var(--ffe-v-button-task-primary-color);
}

Expand Down
3 changes: 2 additions & 1 deletion packages/ffe-buttons/less/inline-base-button.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

.ffe-inline-button--back {
color: var(--ffe-v-button-primary-color);
line-height: 24px;
line-height: 1;
padding: var(--ffe-spacing-xs) var(--ffe-spacing-md) var(--ffe-spacing-xs)
var(--ffe-spacing-2xl);
outline: none;
Expand All @@ -61,6 +61,7 @@

.ffe-inline-button__icon {
color: var(--ffe-v-button-primary-color);
display: block;
}

@media (hover: hover) and (pointer: fine) {
Expand Down

0 comments on commit 728cda7

Please sign in to comment.