diff --git a/web/components/button.css b/web/components/button.css
--- a/web/components/button.css
+++ b/web/components/button.css
@@ -1,76 +1,66 @@
.btn {
+ --border-width: 1px;
+ --border-radius: 4px;
+
+ position: relative;
display: flex;
align-items: center;
justify-content: center;
- background: var(--settings-btn-bg);
- border: 1px solid transparent;
+ border: var(--border-width) solid transparent;
font-size: var(--m-font-16);
padding: 12px 24px;
- border-radius: 4px;
- cursor: pointer;
-}
-
-.btn:hover {
- transition-duration: 200ms;
- transition-property: background, color;
-}
-
-.btn:disabled {
- cursor: not-allowed;
- color: var(--btn-disabled-color);
-}
-
-.primary {
- background: var(--btn-bg-primary);
color: var(--fg);
+ border-radius: var(--border-radius);
+ cursor: pointer;
}
-.primary:hover {
- background: var(--btn-bg-primary-hover);
-}
-
-.primary:disabled {
- background: var(--btn-bg-primary-disabled);
-}
-
-.secondary {
- background: var(--btn-bg-secondary);
- color: var(--fg);
- border-color: var(--btn-secondary-border);
+.btn.outline {
+ border: var(--border-width) solid var(--btn-outline-border);
}
-.secondary:hover {
- background: var(--btn-bg-secondary-hover);
+.btn > * {
+ position: relative;
}
-.secondary:disabled {
- background: var(--btn-bg-secondary-disabled);
+.btn::before {
+ content: '';
+ border: inherit;
+ border-radius: inherit;
+ background: inherit;
+ position: absolute;
+ top: calc(-1 * var(--border-width));
+ left: calc(-1 * var(--border-width));
+ width: 100%;
+ height: 100%;
}
-.success {
- background: var(--btn-bg-success);
- color: var(--fg);
+.btn.outline::before {
+ top: 0;
+ left: 0;
+ border: none;
+ border-radius: calc(var(--border-radius) - var(--border-width));
}
-.success:hover {
- background: var(--btn-bg-success-hover);
+.btn:hover::before {
+ transition-duration: 200ms;
+ transition-property: filter;
}
-.success:disabled {
- background: var(--btn-bg-success-disabled);
+.btn:hover:not(:disabled)::before {
+ filter: brightness(0.8);
}
-.danger {
- background: var(--btn-bg-danger);
- color: var(--fg);
+.btn.outline:hover:not(:disabled)::before {
+ filter: brightness(2);
}
-.danger:hover {
- background: var(--btn-bg-danger-hover);
+.btn:disabled {
+ cursor: not-allowed;
+ color: var(--btn-disabled-color);
}
-.danger:disabled {
- background: var(--btn-bg-danger-disabled);
+.btn:not(.outline):disabled::before {
+ background-color: var(--btn-bg-disabled);
}
.round {
diff --git a/web/components/button.react.js b/web/components/button.react.js
--- a/web/components/button.react.js
+++ b/web/components/button.react.js
@@ -5,17 +5,32 @@
import css from './button.css';
-export type ButtonVariant =
- | 'primary'
- | 'secondary'
- | 'success'
- | 'danger'
- | 'round';
+export type ButtonVariant = 'filled' | 'outline' | 'round';
+export type ButtonColor = {
+ +backgroundColor?: string,
+ +color?: string,
+};
+
+export const buttonThemes: { [string]: ButtonColor } = {
+ standard: {
+ backgroundColor: 'var(--btn-bg-filled)',
+ },
+ danger: {
+ backgroundColor: 'var(--btn-bg-danger)',
+ },
+ success: {
+ backgroundColor: 'var(--btn-bg-success)',
+ },
+ outline: {
+ backgroundColor: 'var(--btn-bg-outline)',
+ },
+};
export type ButtonProps = {
+onClick: (event: SyntheticEvent) => mixed,
+children: React.Node,
+variant?: ButtonVariant,
+ +buttonColor?: ButtonColor,
+type?: string,
+disabled?: boolean,
+className?: string,
@@ -25,21 +40,40 @@
const {
onClick,
children,
- variant = 'primary',
+ variant = 'filled',
+ buttonColor,
type,
disabled = false,
className = '',
} = props;
+
const btnCls = classnames(css.btn, css[variant]);
+ let style;
+ if (buttonColor) {
+ style = buttonColor;
+ } else if (variant === 'outline') {
+ style = buttonThemes.outline;
+ } else {
+ style = buttonThemes.standard;
+ }
+
+ const wrappedChildren = React.Children.map(children, child => {
+ if (typeof child === 'string' || typeof child === 'number') {
+ return {child};
+ }
+ return child;
+ });
+
return (
);
}
diff --git a/web/components/stepper.react.js b/web/components/stepper.react.js
--- a/web/components/stepper.react.js
+++ b/web/components/stepper.react.js
@@ -37,7 +37,7 @@
return (
-
+
Cancel
-
+
Yes, leave chat
diff --git a/web/modals/threads/members/add-members-modal.react.js b/web/modals/threads/members/add-members-modal.react.js
--- a/web/modals/threads/members/add-members-modal.react.js
+++ b/web/modals/threads/members/add-members-modal.react.js
@@ -147,12 +147,12 @@
/>
-
+
Cancel
Add selected members
diff --git a/web/modals/threads/settings/thread-settings-delete-tab.react.js b/web/modals/threads/settings/thread-settings-delete-tab.react.js
--- a/web/modals/threads/settings/thread-settings-delete-tab.react.js
+++ b/web/modals/threads/settings/thread-settings-delete-tab.react.js
@@ -14,6 +14,7 @@
useServerCall,
} from 'lib/utils/action-utils';
+import { buttonThemes } from '../../../components/button.react';
import SWMansionIcon from '../../../SWMansionIcon.react';
import Input from '../../input.react';
import SubmitSection from './submit-section.react';
@@ -118,7 +119,8 @@
{
@@ -127,7 +127,12 @@
}, [dispatchActionPromise, updateRelationshipsActionPromise]);
return (
-
+
{icon}
{text}
diff --git a/web/settings/account-delete-modal.react.js b/web/settings/account-delete-modal.react.js
--- a/web/settings/account-delete-modal.react.js
+++ b/web/settings/account-delete-modal.react.js
@@ -18,7 +18,7 @@
useServerCall,
} from 'lib/utils/action-utils';
-import Button from '../components/button.react';
+import Button, { buttonThemes } from '../components/button.react';
import Input from '../modals/input.react';
import Modal from '../modals/modal.react';
import { useSelector } from '../redux/redux-utils';
@@ -89,7 +89,8 @@
/>
Delete Account
Delete Account
diff --git a/web/settings/password-change-modal.js b/web/settings/password-change-modal.js
--- a/web/settings/password-change-modal.js
+++ b/web/settings/password-change-modal.js
@@ -113,7 +113,7 @@
diff --git a/web/settings/relationship/add-users-list-modal.react.js b/web/settings/relationship/add-users-list-modal.react.js
--- a/web/settings/relationship/add-users-list-modal.react.js
+++ b/web/settings/relationship/add-users-list-modal.react.js
@@ -7,7 +7,7 @@
RelationshipAction,
} from 'lib/types/relationship-types.js';
-import type { ButtonVariant } from '../../components/button.react.js';
+import type { ButtonColor } from '../../components/button.react.js';
import SearchModal from '../../modals/search-modal.react';
import AddUsersList from './add-users-list.react.js';
@@ -16,7 +16,7 @@
+name: string,
+excludedStatuses: $ReadOnlySet,
+confirmButtonContent: React.Node,
- +confirmButtonVariant?: ButtonVariant,
+ +confirmButtonColor?: ButtonColor,
+relationshipAction: RelationshipAction,
};
@@ -26,7 +26,7 @@
name,
excludedStatuses,
confirmButtonContent,
- confirmButtonVariant = 'primary',
+ confirmButtonColor,
relationshipAction,
} = props;
@@ -36,7 +36,7 @@
searchText={searchText}
excludedStatuses={excludedStatuses}
confirmButtonContent={confirmButtonContent}
- confirmButtonVariant={confirmButtonVariant}
+ confirmButtonColor={confirmButtonColor}
relationshipAction={relationshipAction}
closeModal={closeModal}
/>
@@ -44,7 +44,7 @@
[
excludedStatuses,
confirmButtonContent,
- confirmButtonVariant,
+ confirmButtonColor,
relationshipAction,
closeModal,
],
diff --git a/web/settings/relationship/add-users-list.react.js b/web/settings/relationship/add-users-list.react.js
--- a/web/settings/relationship/add-users-list.react.js
+++ b/web/settings/relationship/add-users-list.react.js
@@ -20,7 +20,7 @@
} from 'lib/utils/action-utils.js';
import Button from '../../components/button.react.js';
-import type { ButtonVariant } from '../../components/button.react.js';
+import type { ButtonColor } from '../../components/button.react.js';
import Label from '../../components/label.react.js';
import LoadingIndicator from '../../loading-indicator.react.js';
import { useSelector } from '../../redux/redux-utils.js';
@@ -36,7 +36,7 @@
+excludedStatuses?: $ReadOnlySet,
+closeModal: () => void,
+confirmButtonContent: React.Node,
- +confirmButtonVariant: ButtonVariant,
+ +confirmButtonColor?: ButtonColor,
+relationshipAction: RelationshipAction,
};
@@ -46,7 +46,7 @@
excludedStatuses = new Set(),
closeModal,
confirmButtonContent,
- confirmButtonVariant,
+ confirmButtonColor,
relationshipAction,
} = props;
@@ -232,13 +232,14 @@
{userRows}
{errors}
-
+
Cancel
{buttonContent}
diff --git a/web/settings/relationship/block-users-modal.react.js b/web/settings/relationship/block-users-modal.react.js
--- a/web/settings/relationship/block-users-modal.react.js
+++ b/web/settings/relationship/block-users-modal.react.js
@@ -9,6 +9,7 @@
userRelationshipStatus,
} from 'lib/types/relationship-types.js';
+import { buttonThemes } from '../../components/button.react';
import AddUsersListModal from './add-users-list-modal.react.js';
const excludedStatuses = new Set([
@@ -36,7 +37,7 @@
name="Block Users"
excludedStatuses={excludedStatuses}
confirmButtonContent={buttonContent}
- confirmButtonVariant="danger"
+ confirmButtonColor={buttonThemes.danger}
relationshipAction={relationshipActions.BLOCK}
/>
);
diff --git a/web/settings/relationship/user-list-row.css b/web/settings/relationship/user-list-row.css
--- a/web/settings/relationship/user-list-row.css
+++ b/web/settings/relationship/user-list-row.css
@@ -23,7 +23,7 @@
.button {
font-size: var(--s-font-14);
line-height: var(--line-height-text);
- color: var(--btn-bg-primary);
+ color: var(--btn-bg-filled);
cursor: pointer;
background: none;
border: none;
diff --git a/web/theme.css b/web/theme.css
--- a/web/theme.css
+++ b/web/theme.css
@@ -60,18 +60,11 @@
--success: var(--success-dark-50);
/* Color Theme */
- --btn-bg-primary: var(--violet-dark-100);
- --btn-bg-primary-hover: var(--violet-dark-80);
- --btn-bg-primary-disabled: var(--shades-black-80);
- --btn-bg-secondary: var(--shades-black-90);
- --btn-bg-secondary-hover: var(--shades-black-80);
- --btn-bg-secondary-disabled: var(--shades-black-90);
+ --btn-bg-filled: var(--violet-dark-100);
+ --btn-bg-outline: var(--shades-black-90);
--btn-bg-success: var(--success-dark-50);
- --btn-bg-success-hover: var(--success-dark-90);
- --btn-bg-success-disabled: var(--shades-black-80);
--btn-bg-danger: var(--error-primary);
- --btn-bg-danger-hover: var(--error-dark-50);
- --btn-bg-danger-disabled: var(--shades-black-80);
+ --btn-bg-disabled: var(--shades-black-80);
--btn-disabled-color: var(--shades-black-60);
--chat-bg: var(--violet-dark-80);
--chat-confirmation-icon: var(--violet-dark-100);
@@ -96,7 +89,7 @@
--help-color: var(--shades-black-60);
--breadcrumb-color: var(--shades-white-60);
--breadcrumb-color-unread: var(--shades-white-60);
- --btn-secondary-border: var(--shades-black-60);
+ --btn-outline-border: var(--shades-black-60);
--thread-color-read: var(--shades-black-60);
--thread-from-color-read: var(--shades-black-80);
--thread-last-message-color-read: var(--shades-black-60);