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

Add tertiary-theme to MdButton #126

Merged
merged 3 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
46 changes: 46 additions & 0 deletions packages/css/src/button/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,52 @@
color: var(--mdPrimaryColor);
}

.md-button--secondary:disabled > .md-button__rightIcon {
color: var(--mdGreyColor20);
}

.md-button--tertiary {
background-color: #ffffff;
border: none;
border-radius: 0.43rem;
color: var(--mdPrimaryColor);
padding: calc(0.75rem - 2px) calc(1.5rem - 2px);
}

.md-button--small.md-button--tertiary {
padding: calc(0.4rem - 2px) calc(0.8rem - 2px);
}

.md-button--tertiary:hover:enabled {
text-decoration: underline;
background-color: var(--mdPrimaryColor20);
}

.md-button--tertiary:focus:enabled {
border-color: var(--mdPrimaryColor);
outline: 2px var(--mdPrimaryColor80) solid;
background-color: #ffffff;
outline-offset: 0px;
}

.md-button--tertiary:focus:hover:enabled {
background-color: var(--mdPrimaryColor20);
}

.md-button--tertiary:disabled {
background-color: #fff;
color: var(--mdGreyColor20);
border-color: var(--mdGreyColor20);
}

.md-button--tertiary > .md-button__rightIcon {
color: var(--mdPrimaryColor);
}

.md-button--tertiary:disabled > .md-button__rightIcon {
color: var(--mdGreyColor20);
}

.md-button--danger {
background-color: var(--mdErrorColor);
}
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/button/MdButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const MdButton: React.FunctionComponent<MdButtonProps> = ({
{
'md-button--small': !!small,
'md-button--secondary': theme === 'secondary',
'md-button--tertiary': theme === 'tertiary',
'md-button--danger': theme === 'danger',
'md-button--column': !!topIcon,
},
Expand Down
10 changes: 9 additions & 1 deletion stories/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default {
summary: 'text',
},
},
options: ['primary', 'secondary', 'danger'],
options: ['primary', 'secondary', 'danger', 'tertiary'],
control: { type: 'inline-radio' },
if: { arg: 'theme', exists: true },
},
Expand Down Expand Up @@ -157,6 +157,14 @@ Secondary.args = {
small: false,
};

export const Tertiary = Template.bind({});
Tertiary.args = {
theme: 'tertiary',
label: 'Tertiærknapp',
disabled: false,
small: false,
};

export const Error = Template.bind({});
Error.args = {
theme: 'danger',
Expand Down
Loading