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

[C-3233, C-3218, C-3240] Update button styles; fix dark mode styles #6400

Merged
merged 16 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 13 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
55 changes: 47 additions & 8 deletions packages/harmony/src/components/button/Button.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

/* Secondary */
.secondary {
--button-color: var(--harmony-n-300);
--button-color: var(--harmony-border-strong);
--text-color: var(--harmony-text-default);
background: transparent;
box-shadow: none;
Expand All @@ -138,16 +138,24 @@

/* Tertiary */
.tertiary {
--button-color: var(--harmony-n-300);
--button-color: var(--harmony-border-default);
--text-color: var(--harmony-text-default);
background: var(--harmony-static-white);
background-color: var(--harmony-bg-white);
opacity: .85;
backdrop-filter: blur(6px);
}
.tertiary:hover {
--button-color: var(--harmony-border-strong);
box-shadow: var(--harmony-shadow-mid);
opacity: 1;
backdrop-filter: none;
}
.tertiary:active {
--button-color: var(--harmony-border-strong);
background-color: var(--harmony-n-50);
box-shadow: none;
opacity: 1;
backdrop-filter: none;
}

/* Destructive */
Expand All @@ -167,7 +175,8 @@
}
.destructive:active {
--button-color: var(--harmony-red);
--text-color: var(--harmony-static-white); --overlay-color: var(--harmony-static-black);
--text-color: var(--harmony-static-white);
--overlay-color: var(--harmony-static-black);
--overlay-opacity: 0.2;
background-color: var(--button-color);
box-shadow: none;
Expand All @@ -178,16 +187,16 @@
box-shadow: none;
}

.primary.disabled,
.secondary.disabled {
.primary.disabled {
--button-color: var(--harmony-n-150);
--text-color: var(--harmony-static-white);
background-color: var(--harmony-n-150);
border-color: var(--harmony-n-150);
}

.destructive.disabled,
.tertiary.disabled {
.secondary.disabled,
.tertiary.disabled,
.destructive.disabled {
opacity: 0.45;
}

Expand All @@ -201,3 +210,33 @@
padding: 0;
height: 100%;
}

/* Dark mode */
html[data-theme='dark'] {
.primary:hover {
--overlay-opacity: 0.2;
}
.primary.disabled {
--button-color: var(--harmony-n-150);
--text-color: var(--harmony-white);
}

.secondary:hover {
--overlay-opacity: 0.2;
}

.tertiary {
--button-color: var(--harmony-bg-white);
--text-color: var(--harmony-text-default);
background-color: var(--button-color);
opacity: .6;
}
.tertiary:hover {
--button-color: var(--harmony-bg-white);
opacity: 1;
}
.tertiary:active {
--button-color: var(--harmony-n-50);
background-color: var(--button-color);
}
}
30 changes: 0 additions & 30 deletions packages/harmony/src/components/button/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react'

import * as Icons from '../typography/Icons'

import { Button } from './Button'
import { ButtonProps, ButtonSize, ButtonType } from './types'

const baseProps: ButtonProps = {
iconLeft: Icons.IconCampfire,
iconRight: Icons.IconCampfire,
text: 'Click Me'
}

Expand All @@ -34,32 +30,6 @@ const meta: Meta<typeof Button> = {
<Button {...baseProps} size={ButtonSize.DEFAULT} {...props} disabled />
<Button {...baseProps} size={ButtonSize.LARGE} {...props} disabled />
</div>
<div style={{ alignItems: 'center', display: 'flex', gap: '16px' }}>
<Button
{...baseProps}
size={ButtonSize.SMALL}
{...props}
text='Loading'
minWidth={123}
isLoading
/>
<Button
{...baseProps}
size={ButtonSize.DEFAULT}
{...props}
text='Loading'
minWidth={180}
isLoading
/>
<Button
{...baseProps}
size={ButtonSize.LARGE}
{...props}
text='Loading'
minWidth={212}
isLoading
/>
</div>
</div>
)
}
Expand Down