Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

refactor: restyle button (#299)

Guilherme Oenningf3d4d519d9d4
diff --git a/public/assets/styles/main.scss b/public/assets/styles/main.scss
index b27627448..3bcd032d8 100644
--- a/public/assets/styles/main.scss
+++ b/public/assets/styles/main.scss
@@ -6,6 +6,14 @@
text-align: center;
}
+*:focus {
+ outline: 0;
+}
+
+[type=reset], [type=submit], button, html [type=button] {
+ -webkit-appearance: button;
+}
+
.page::after {
content: "";
clear: both;
@@ -16,10 +24,6 @@ noscript {
margin-top: 20px;
}
-.ui.button.text-left {
- text-align: left;
-}
-
body {
background-color: $bg-color;
}
@@ -143,6 +147,7 @@ code {
.fdr-avatar {
border-radius: 50%;
width: 30px;
+ height: 30px;
vertical-align: middle;
padding: 1px;
&.staff {
@@ -163,37 +168,6 @@ code {
}
}
-.support-counter {
- margin-right: 10px;
-
- .button,
- .button.disabled {
- font-size: 18px;
- min-width: 45px;
- margin: 0 auto !important;
- padding: 0rem 0rem 0.5rem 0rem !important;
- background-color: #fff !important;
-
- i.icon {
- color: #C4C9CD;
- }
- }
-
- .button.supported,
- .button.no-touch:hover {
- color: $main-color;
-
- i.icon {
- color: lighten($main-color, 20%) !important;
- }
- }
-
- i.icon {
- margin: 0 auto !important;
- display: block;
- }
-}
-
.fdr-profile-popup div.item {
padding: 5px 0px !important;
}
@@ -292,10 +266,6 @@ code {
.column {
padding: 10px 5px !important;
}
-
- .button.fluid {
- padding: 10px 5px;
- }
}
#signin-modal,
diff --git a/public/assets/styles/variables.scss b/public/assets/styles/variables.scss
index 5a49c253e..369ffeaa0 100644
--- a/public/assets/styles/variables.scss
+++ b/public/assets/styles/variables.scss
@@ -1,16 +1,38 @@
-$main-color: #0069ff; //#0c9
+$font-size-mini: 10px;
+$font-size-tiny: 11px;
+$font-size-small: 12px;
+$font-size: 14px;
+$font-size-large: 16px;
+
+$main-color: #0069ff;
$admin-color: #365899;
$bg-color: #fff;
$menu-color: #f9f9f9;
+$text-color: #333;
$link-color: #07C;
-$negative-color: #db2828;
-$positive-color: #21ba45;
+
+// Buttons
+$white: #fff;
+$gray-lighter: #eee;
+$gray-darker: #d5d5d5;
+$green: #15CD72;
+$green-darker: #0CB863;
+$red: #db2828;
@function textColorFor($color) {
@if (lightness($color) > 60) {
- @return #484848; // Lighter backgorund, return dark color
+ @return #484848; // Lighter background, return dark color
} @else {
@return #ffffff; // Darker background, return light color
}
+}
+
+@mixin disabled() {
+ cursor: default;
+ opacity: .45!important;
+ background-image: none!important;
+ -webkit-box-shadow: none!important;
+ box-shadow: none!important;
+ pointer-events: none!important;
}
\ No newline at end of file
diff --git a/public/components/SupportCounter.scss b/public/components/SupportCounter.scss
new file mode 100644
index 000000000..1c465495f
--- /dev/null
+++ b/public/components/SupportCounter.scss
@@ -0,0 +1,41 @@
+@import '~@fider/assets/styles/variables.scss';
+
+.c-support-counter {
+ margin-right: 10px;
+
+ button,
+ button.supported,
+ button.disabled {
+ font-size: 18px;
+ border: none;
+ width: 45px;
+ font-weight: 700;
+ cursor: pointer;
+ background-color: $bg-color;
+ text-align: center;
+ margin: 0 auto;
+ padding: 0 0;
+
+ i.icon {
+ color: #C4C9CD;
+ }
+ }
+
+ button.disabled {
+ @include disabled();
+ }
+
+ button.supported,
+ button.no-touch:hover {
+ color: $main-color;
+
+ i.icon {
+ color: lighten($main-color, 20%) !important;
+ }
+ }
+
+ i.icon {
+ margin: 0 auto;
+ display: block;
+ }
+}
\ No newline at end of file
diff --git a/public/components/SupportCounter.tsx b/public/components/SupportCounter.tsx
index 10254fad3..57c8dd8c8 100644
--- a/public/components/SupportCounter.tsx
+++ b/public/components/SupportCounter.tsx
@@ -1,6 +1,8 @@
+import './SupportCounter.scss';
+
import * as React from 'react';
import { Idea, User, IdeaStatus } from '@fider/models';
-import { page, actions } from '@fider/services';
+import { page, actions, classSet } from '@fider/services';
interface SupportCounterProps {
user?: User;
@@ -40,12 +42,17 @@ export class SupportCounter extends React.Component<SupportCounterProps, Support
}
public render() {
- const noTouch = !('ontouchstart' in window);
const status = IdeaStatus.Get(this.props.idea.status);
+ const className = classSet({
+ 'supported': !status.closed && this.state.supported,
+ 'disabled': status.closed,
+ 'no-touch': !('ontouchstart' in window),
+ });
+
const vote = (
<button
- className={`ui button ${noTouch ? 'no-touch' : ''} ${this.state.supported ? 'supported' : ''} `}
+ className={className}
onClick={async () => await this.supportOrUndo()}
>
<i className="medium caret up icon" />
@@ -54,14 +61,14 @@ export class SupportCounter extends React.Component<SupportCounterProps, Support
);
const disabled = (
- <div className="ui button disabled">
+ <div className={className}>
<i className="medium caret up icon" />
{this.state.total}
</div>
);
return (
- <div className="support-counter ui">
+ <div className="c-support-counter">
{status.closed ? disabled : vote}
</div>
);
diff --git a/public/components/common/Button.scss b/public/components/common/Button.scss
index 4c7ff9d08..318a9ec0f 100644
--- a/public/components/common/Button.scss
+++ b/public/components/common/Button.scss
@@ -1,26 +1,168 @@
@import '~@fider/assets/styles/variables.scss';
-.as-link {
- padding: 0;
- font-size: 12px;
- border: none;
- outline: none;
+.c-button {
cursor: pointer;
- background-color: transparent;
-
- i {
- margin: 0;
+ font-size: $font-size;
+ color: $text-color;
+ border-radius: 3px;
+ background-color: $gray-lighter;
+ border: none;
+ margin: 0 4px 0 0;
+ padding: 10px;
+ text-align: left;
+ font-weight: 700;
+
+ &.green {
+ color: $white;
+ background-color: $green;
+
+ &:hover {
+ background-color: $green-darker;
+ }
}
-
+
+ &.red {
+ color: $red;
+ border: 1px solid $red;
+ background-color: transparent;
+
+ &:hover {
+ color: $white;
+ background-color: $red;
+ }
+ }
+
&:hover {
- text-decoration: underline;
+ background-color: $gray-darker;
}
- &.negative {
- color: $negative-color;
+ &.mini {
+ padding: 7px;
+ font-size: $font-size-mini;
+ }
+
+ &.tiny {
+ padding: 8px;
+ font-size: $font-size-tiny;
+ }
+
+ &.small {
+ padding: 9px;
+ font-size: $font-size-small;
+ }
+
+ &.large {
+ padding: 11px;
+ font-size: $font-size-large;
+ }
+
+ &.fluid {
+ display: block;
+ width: 100%;
+ }
+
+ &.loading {
+ position: relative;
+ cursor: default;
+ text-shadow: none!important;
+ color: transparent!important;
+ opacity: 1;
+ pointer-events: auto;
+ -webkit-transition: all 0s linear,opacity .1s ease;
+ transition: all 0s linear,opacity .1s ease;
+
+ &:before {
+ position: absolute;
+ content: '';
+ top: 50%;
+ left: 50%;
+ margin: -.64285714em 0 0 -.64285714em;
+ width: 1.28571429em;
+ height: 1.28571429em;
+ border-radius: 500rem;
+ border: .2em solid rgba(0,0,0,.15);
+ }
+
+ &:after {
+ position: absolute;
+ content: '';
+ top: 50%;
+ left: 50%;
+ margin: -.64285714em 0 0 -.64285714em;
+ width: 1.28571429em;
+ height: 1.28571429em;
+ -webkit-animation: button-spin .6s linear;
+ animation: button-spin .6s linear;
+ -webkit-animation-iteration-count: infinite;
+ animation-iteration-count: infinite;
+ border-radius: 500rem;
+ border-color: #fff transparent transparent;
+ border-style: solid;
+ border-width: .2em;
+ -webkit-box-shadow: 0 0 0 1px transparent;
+ box-shadow: 0 0 0 1px transparent;
+ }
+ }
+
+ &.disabled {
+ @include disabled();
+ }
+
+ &.social {
+ background-color: $white;
+ color: $text-color;
+ text-align: center;
+ box-shadow: 0 0 0 1px rgba(20,11,47,0.1), 0 2px 4px -2px rgba(0,0,0,0.2);
+
+ .svg {
+ display: inline-block;
+ vertical-align: middle;
+ width: 24px;
+ background-size: 100%;
+ height: 24px;
+ margin-right: 5px;
+ }
+
+ &.loading .svg {
+ display: none;
+ }
+
+ &.google .svg {
+ background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHg9IjBweCIgeT0iMHB4IgogICAgIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIKICAgICB2aWV3Qm94PSIwIDAgNDggNDgiCiAgICAgc3R5bGU9ImZpbGw6IzAwMDAwMDsiPjxnIGlkPSJzdXJmYWNlMSI+PHBhdGggc3R5bGU9IiBmaWx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ciIHg9IjBweCIgeT0iMHB4IgogICAgIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIKICAgICB2aWV3Qm94PSIwIDAgNDggNDgiCiAgICAgc3R5bGU9ImZpbGw6IzAwMDAwMDsiPjxnIGlkPSJzdXJmYWNlMSI+PHBhdGggc3R5bGU9IiBmaWxsOiMzRjUxQjU7IiBkPSJNIDQyIDM3IEMgNDIgMzkuNzYxNzE5IDM5Ljc2MTcxOSA0MiAzNyA0MiBMIDExIDQyIEMgOC4yMzgyODEgNDIgNiAzOS43NjE3MTkgNiAzNyBMIDYgMTEgQyA2IDguMjM4MjgxIDguMjM4MjgxIDYgMTEgNiBMIDM3IDYgQyAzOS43NjE3MTkgNiA0MiA4LjIzODI4MSA0MiAxMSBaICI+PC9wYXRoPjxwYXRoIHN0eWxlPSIgZmlsbDojRkZGRkZGOyIgZD0iTSAzNC4zNjcxODggMjUgTCAzMSAyNSBMIDMxIDM4IEwgMjYgMzggTCAyNiAyNSBMIDIzIDI1IEwgMjMgMjEgTCAyNiAyMSBMIDI2IDE4LjU4OTg0NCBDIDI2LjAwMzkwNiAxNS4wODIwMzEgMjcuNDYwOTM4IDEzIDMxLjU5Mzc1IDEzIEwgMzUgMTMgTCAzNSAxNyBMIDMyLjcxNDg0NCAxNyBDIDMxLjEwNTQ2OSAxNyAzMSAxNy42MDE1NjMgMzEgMTguNzIyNjU2IEwgMzEgMjEgTCAzNSAyMSBaICI+PC9wYXRoPjwvZz48L3N2Zz4=') 50% 50% no-repeat;
+ }
+
+ &:hover {
+ background-color: #fafafb;
+ color: $text-color;
+ }
+ }
+}
+
+@-webkit-keyframes button-spin {
+ from {
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
+ }
+ to {
+ -webkit-transform: rotate(360deg);
+ transform: rotate(360deg);
+ }
+}
+@keyframes button-spin {
+ from {
+ -webkit-transform: rotate(0deg);
+ transform: rotate(0deg);
}
-
- &.positive {
- color: $positive-color;
+ to {
+ -webkit-transform: rotate(360deg);
+ transform: rotate(360deg);
}
}
\ No newline at end of file
diff --git a/public/components/common/Button.tsx b/public/components/common/Button.tsx
index e64f019cd..aa2c736b4 100644
--- a/public/components/common/Button.tsx
+++ b/public/components/common/Button.tsx
@@ -1,10 +1,14 @@
import * as React from 'react';
+import { classSet } from '@fider/services';
interface ButtonProps {
className?: string;
simple?: boolean;
+ disabled?: boolean;
href?: string;
- size?: 'mini' | 'tiny' | 'small' | 'large';
+ color?: 'green' | 'red';
+ fluid?: boolean;
+ size?: 'mini' | 'tiny' | 'small' | 'normal' | 'large';
onClick?: (event: ButtonClickEvent) => Promise<any>;
}
@@ -28,7 +32,8 @@ export class Button extends React.Component<ButtonProps, ButtonState> {
private unmounted: boolean = false;
public static defaultProps: Partial<ButtonProps> = {
- size: 'tiny',
+ size: 'normal',
+ fluid: false,
};
public constructor(props: ButtonProps) {
@@ -63,16 +68,27 @@ export class Button extends React.Component<ButtonProps, ButtonState> {
}
public render() {
- const cssClasses = `ui ${this.props.size} ${this.props.simple ? 'as-link' : 'button'} ${this.props.className || ''} ${this.state.clicked ? 'loading disabled' : ''}`;
+ // TODO: as-link if simple === true
+
+ const className = classSet({
+ 'c-button': true,
+ 'fluid': this.props.fluid,
+ [this.props.size!]: this.props.size,
+ [this.props.color!]: this.props.color,
+ 'loading': this.state.clicked,
+ 'disabled': this.state.clicked || this.props.disabled,
+ [this.props.className!]: this.props.className,
+ });
+
if (this.props.href) {
return (
- <a href={this.props.href} className={cssClasses} onClick={() => this.click()}>
+ <a href={this.props.href} className={className} onClick={() => this.click()}>
{this.props.children}
</a>
);
} else {
return (
- <button type="button" className={cssClasses} onClick={(e) => this.click(e)}>
+ <button type="button" className={className} onClick={(e) => this.click(e)}>
{this.props.children}
</button>
);
diff --git a/public/components/common/Gravatar.tsx b/public/components/common/Gravatar.tsx
index cf796a1a5..fc305ce63 100644
--- a/public/components/common/Gravatar.tsx
+++ b/public/components/common/Gravatar.tsx
@@ -17,7 +17,7 @@ export const Gravatar = (props: GravatarProps) => {
return (
<img
ref={(e) => element = e}
- className={`fdr-avatar image ${isCollaborator && 'staff'}`}
+ className={`ui fdr-avatar image ${isCollaborator && 'staff'}`}
title={name}
src={url}
/>
diff --git a/public/components/common/Header.scss b/public/components/common/Header.scss
new file mode 100644
index 000000000..19f2eaa89
--- /dev/null
+++ b/public/components/common/Header.scss
@@ -0,0 +1,7 @@
+.c-header {
+ .ui.vertical.menu .item > .label {
+ float: none;
+ position: absolute;
+ right: 5px;
+ }
+}
\ No newline at end of file
diff --git a/public/components/common/Header.tsx b/public/components/common/Header.tsx
index 3cc1992d4..f6c866dfe 100644
--- a/public/components/common/Header.tsx
+++ b/public/components/common/Header.tsx
@@ -1,3 +1,5 @@
+import './Header.scss';
+
import * as React from 'react';
import { SystemSettings, CurrentUser, Tenant } from '@fider/models';
import { SignInControl, EnvironmentInfo, Gravatar } from '@fider/components/common';
@@ -68,7 +70,7 @@ export class Header extends React.Component<HeaderProps, HeaderState> {
);
return (
- <div>
+ <div className="c-header">
<EnvironmentInfo system={this.props.system}/>
<div id="menu" className="ui small borderless menu">
<div className="ui container">
diff --git a/public/components/common/SignInControl.tsx b/public/components/common/SignInControl.tsx
index 8e5ffa7e4..2f259c76e 100644
--- a/public/components/common/SignInControl.tsx
+++ b/public/components/common/SignInControl.tsx
@@ -95,7 +95,7 @@ export class SignInControl extends React.Component<SignInControlProps, SignInCon
<Form ref={(f) => { this.form = f!; }}>
<div id="email-signin" className="ui small action fluid input">
<input onChange={(e) => this.setState({ email: e.currentTarget.value })} type="text" placeholder="[email protected]" className="small" />
- <Button onClick={() => this.signIn()} className={`positive ${this.state.email === '' && 'disabled'}`}>
+ <Button color="green" disabled={this.state.email === ''} onClick={() => this.signIn()}>
Sign in
</Button>
</div>
diff --git a/public/components/common/SocialSignInButton.tsx b/public/components/common/SocialSignInButton.tsx
index 6cac99601..551a068d9 100644
--- a/public/components/common/SocialSignInButton.tsx
+++ b/public/components/common/SocialSignInButton.tsx
@@ -9,18 +9,15 @@ interface SocialSignInButtonProps {
const providers = {
google: {
name: 'Google',
- class: 'google plus',
- icon: 'google'
+ class: 'social google',
},
facebook: {
name: 'Facebook',
- class: 'facebook',
- icon: 'facebook f'
+ class: 'social facebook',
},
github: {
name: 'GitHub',
- class: 'github black',
- icon: 'github'
+ class: 'social github',
}
};
@@ -29,8 +26,8 @@ export class SocialSignInButton extends React.Component<SocialSignInButtonProps,
const href = `${this.props.oauthEndpoint}/oauth/${this.props.provider}?redirect=${location.href}`;
return (
- <Button size="small" href={href} className={`${providers[this.props.provider].class} fluid`}>
- <i className={`icon ${providers[this.props.provider].icon}`} />
+ <Button href={href} fluid={true} className={providers[this.props.provider].class}>
+ <i className="svg" />
<span>{providers[this.props.provider].name}</span>
</Button>
);
diff --git a/public/index.tsx b/public/index.tsx
index d0001c5e3..5533563df 100644
--- a/public/index.tsx
+++ b/public/index.tsx
@@ -23,7 +23,6 @@ import 'semantic-ui-css/components/table.min.css';
import 'semantic-ui-css/components/checkbox.min.css';
import 'semantic-ui-css/components/transition.min.css';
import 'semantic-ui-css/components/header.min.css';
-import 'semantic-ui-css/components/button.min.css';
import 'semantic-ui-css/components/form.min.css';
import 'semantic-ui-css/components/container.min.css';
import 'semantic-ui-css/components/modal.min.css';
diff --git a/public/pages/AdminHome/AdminHome.page.tsx b/public/pages/AdminHome/AdminHome.page.tsx
index 12042a6f4..2043c12ff 100644
--- a/public/pages/AdminHome/AdminHome.page.tsx
+++ b/public/pages/AdminHome/AdminHome.page.tsx
@@ -89,7 +89,7 @@ export class AdminHomePage extends React.Component<AdminHomePageProps, AdminHome
<div className="info">
<p>Use this space to change message of your initial page.</p>
<p>Common use case for this area is a brief description of what is your company/product, why you created this space and how the visitors can collaborate.</p>
- <p>This field is powered by Commonmark. You can style and add links to your message. Learn more at <a target="_blank" href="http://commonmark.org/help/">http://commonmark.org/help/</a>.</p>
+ <p>This field is powered by CommonMark. You can style and add links to your message. Learn more at <a target="_blank" href="http://commonmark.org/help/">http://commonmark.org/help/</a>.</p>
</div>
</div>
<DisplayError fields={['invitation']} error={this.state.error} />
@@ -137,7 +137,7 @@ export class AdminHomePage extends React.Component<AdminHomePageProps, AdminHome
{
this.props.user.isAdministrator &&
<div className="field">
- <Button className="positive" size="tiny" onClick={async (e) => await this.confirm(e)}>Confirm</Button>
+ <Button color="green" size="large" onClick={async (e) => await this.confirm(e)}>Confirm</Button>
</div>
}
</div>
diff --git a/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsx b/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsx
index c9582d541..e197acb59 100644
--- a/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsx
+++ b/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsx
@@ -50,7 +50,7 @@ export class CompleteSignInProfilePage extends React.Component<HomePageProps, Co
placeholder="Your display name"
className="small"
/>
- <Button onClick={() => this.submit()} className={`small positive ${this.state.name === '' && 'disabled'}`}>
+ <Button onClick={() => this.submit()} size="small" color="green" disabled={this.state.name === ''}>
Submit
</Button>
</div>
diff --git a/public/pages/Home/components/IdeaInput.tsx b/public/pages/Home/components/IdeaInput.tsx
index 076d064fb..2637552a7 100644
--- a/public/pages/Home/components/IdeaInput.tsx
+++ b/public/pages/Home/components/IdeaInput.tsx
@@ -25,8 +25,8 @@ export class IdeaInput extends React.Component<IdeaInputProps, IdeaInputState> {
constructor(props: IdeaInputProps) {
super(props);
this.state = {
- title: cache.get(CACHE_TITLE_KEY) || '',
- description: cache.get(CACHE_DESCRIPTION_KEY) || '',
+ title: !!this.props.user && cache.get(CACHE_TITLE_KEY) || '',
+ description: !!this.props.user && cache.get(CACHE_DESCRIPTION_KEY) || '',
focused: false
};
if (this.state) {
@@ -75,7 +75,6 @@ export class IdeaInput extends React.Component<IdeaInputProps, IdeaInputState> {
}
public render() {
- const buttonCss = this.state.title === '' ? 'primary disabled' : 'primary';
const details = (
<div>
<div className="field">
@@ -85,7 +84,7 @@ export class IdeaInput extends React.Component<IdeaInputProps, IdeaInputState> {
placeholder="Describe your idea"
/>
</div>
- <Button className={buttonCss} onClick={(e) => this.submit(e)}>
+ <Button color="green" onClick={(e) => this.submit(e)}>
Submit
</Button>
</div>
diff --git a/public/pages/ManageMembers/ManageMembers.page.tsx b/public/pages/ManageMembers/ManageMembers.page.tsx
index 571d08075..5f5e241a4 100644
--- a/public/pages/ManageMembers/ManageMembers.page.tsx
+++ b/public/pages/ManageMembers/ManageMembers.page.tsx
@@ -64,13 +64,13 @@ export class ManageMembersPage extends React.Component<ManageMembersPageProps, M
<div className="right floated content">
{
removable &&
- <Button size="mini" onClick={() => this.changeRole(user, UserRole.Visitor)} className="red showover">
+ <Button size="tiny" color="red" onClick={() => this.changeRole(user, UserRole.Visitor)} className="showover">
<i className="remove icon" />Remove
</Button>
}
{
addable &&
- <Button size="mini" onClick={() => this.changeRole(user, role)} className="green showover">
+ <Button size="tiny" color="green" onClick={() => this.changeRole(user, role)} className="showover">
<i className="add icon" />Add
</Button>
}
diff --git a/public/pages/ManageTags/ManageTags.page.tsx b/public/pages/ManageTags/ManageTags.page.tsx
index 197dfed34..e6b9b8dba 100644
--- a/public/pages/ManageTags/ManageTags.page.tsx
+++ b/public/pages/ManageTags/ManageTags.page.tsx
@@ -96,7 +96,8 @@ export class ManageTagsPage extends React.Component<ManageTagsPageProps, ManageT
Cancel
</Button>
<Button
- className="negative right floated"
+ color="red"
+ className="right floated"
onClick={() => this.deleteTag(t)}
>
Delete tag
@@ -112,17 +113,15 @@ export class ManageTagsPage extends React.Component<ManageTagsPageProps, ManageT
this.props.user.isAdministrator && [
<Button
key={0}
- simple={true}
onClick={async () => this.setState({ isAdding: false, editing: undefined, deleting: t.id })}
- className="icon negative right floated"
+ className="right floated"
>
<i className="remove icon" />Remove
</Button>,
<Button
key={1}
- simple={true}
onClick={async () => this.setState({ isAdding: false, editing: t.id, deleting: undefined })}
- className="icon right floated"
+ className="right floated"
>
<i className="edit icon" />Edit
</Button>
@@ -153,7 +152,7 @@ export class ManageTagsPage extends React.Component<ManageTagsPageProps, ManageT
/>
</div>
: <Button
- className="positive"
+ color="green"
onClick={async (e) => this.setState({ isAdding: true, deleting: undefined, editing: undefined })}
>
Add new
diff --git a/public/pages/ManageTags/components/TagForm.tsx b/public/pages/ManageTags/components/TagForm.tsx
index 3376e2c61..831fb6912 100644
--- a/public/pages/ManageTags/components/TagForm.tsx
+++ b/public/pages/ManageTags/components/TagForm.tsx
@@ -122,17 +122,8 @@ export class TagForm extends React.Component<TagFormProps, TagFormState> {
/>
</div>
</div>
- <Button
- onClick={async () => this.props.onCancel()}
- >
- Cancel
- </Button>
- <Button
- className="positive"
- onClick={(e) => this.onSave(e)}
- >
- Save
- </Button>
+ <Button onClick={async () => this.props.onCancel()}>Cancel</Button>
+ <Button color="green" onClick={(e) => this.onSave(e)}>Save</Button>
</div>
);
}
diff --git a/public/pages/MySettings/MySettings.page.tsx b/public/pages/MySettings/MySettings.page.tsx
index 3865a7ee8..cd377b1fb 100644
--- a/public/pages/MySettings/MySettings.page.tsx
+++ b/public/pages/MySettings/MySettings.page.tsx
@@ -103,7 +103,7 @@ export class MySettingsPage extends React.Component<MySettingsPageProps, MySetti
value={this.state.newEmail}
onChange={(e) => this.setState({ newEmail: e.currentTarget.value })}
/>
- <Button className="positive" size="mini" onClick={async () => await this.submitNewEmail()}>Confirm</Button>
+ <Button color="green" size="mini" onClick={async () => await this.submitNewEmail()}>Confirm</Button>
<Button size="mini" onClick={async () => this.setState({ changingEmail: false, error: undefined })}>Cancel</Button>
</p>
</>
@@ -139,7 +139,7 @@ export class MySettingsPage extends React.Component<MySettingsPageProps, MySetti
/>
<div className="field">
- <Button className="positive" size="tiny" onClick={async () => await this.confirm()}>Confirm</Button>
+ <Button color="green" size="large" onClick={async () => await this.confirm()}>Confirm</Button>
</div>
</div>
</div>
diff --git a/public/pages/ShowIdea/ShowIdea.page.scss b/public/pages/ShowIdea/ShowIdea.page.scss
index bc7194c3c..694555e7b 100644
--- a/public/pages/ShowIdea/ShowIdea.page.scss
+++ b/public/pages/ShowIdea/ShowIdea.page.scss
@@ -9,6 +9,7 @@
}
.fdr-avatar {
width: 24px;
+ height: 24px;
}
}
@@ -53,7 +54,7 @@
}
i {
display: inline-block;
- color: $positive-color;
+ color: $green;
}
.ui.circular.label {
margin-right: 5px;
diff --git a/public/pages/ShowIdea/ShowIdea.page.tsx b/public/pages/ShowIdea/ShowIdea.page.tsx
index 81d5a781b..15f21d0d0 100644
--- a/public/pages/ShowIdea/ShowIdea.page.tsx
+++ b/public/pages/ShowIdea/ShowIdea.page.tsx
@@ -106,12 +106,12 @@ export class ShowIdeaPage extends React.Component<ShowIdeaPageProps, ShowIdeaPag
?
<div key={1} className="ui list">
<div className="item">
- <Button className="positive icon fluid text-left" onClick={async () => this.saveChanges()}>
+ <Button color="green" fluid={true} onClick={async () => this.saveChanges()}>
<i className="save icon" /> Save
</Button>
</div>
<div className="item">
- <Button className="icon fluid text-left" onClick={async () => this.setState({ error: undefined, editMode: false })}>
+ <Button fluid={true} onClick={async () => this.setState({ error: undefined, editMode: false })}>
<i className="cancel icon" /> Cancel
</Button>
</div>
@@ -119,7 +119,7 @@ export class ShowIdeaPage extends React.Component<ShowIdeaPageProps, ShowIdeaPag
:
<div key={1} className="ui list">
<div className="item">
- <Button className="icon fluid text-left" onClick={async () => this.setState({ editMode: true })}>
+ <Button fluid={true} onClick={async () => this.setState({ editMode: true })}>
<i className="edit icon" /> Edit
</Button>
</div>
diff --git a/public/pages/ShowIdea/components/CommentInput.tsx b/public/pages/ShowIdea/components/CommentInput.tsx
index 0f245cbb4..1189cc63e 100644
--- a/public/pages/ShowIdea/components/CommentInput.tsx
+++ b/public/pages/ShowIdea/components/CommentInput.tsx
@@ -68,7 +68,7 @@ export class CommentInput extends React.Component<CommentInputProps, CommentInpu
</div>
{
this.state.content &&
- <Button className="primary" onClick={() => this.submit()}>
+ <Button color="green" onClick={() => this.submit()}>
Submit
</Button>
}
diff --git a/public/pages/ShowIdea/components/NotificationsPanel.tsx b/public/pages/ShowIdea/components/NotificationsPanel.tsx
index 28f7760d1..c110356de 100644
--- a/public/pages/ShowIdea/components/NotificationsPanel.tsx
+++ b/public/pages/ShowIdea/components/NotificationsPanel.tsx
@@ -37,12 +37,12 @@ export class NotificationsPanel extends React.Component<NotificationsPanelProps,
const button = this.state.subscribed
? (
- <Button className="icon fluid text-left" onClick={this.subscribeOrUnsubscribe}>
+ <Button fluid={true} onClick={this.subscribeOrUnsubscribe}>
<i className="volume off icon" /> Unsubscribe
</Button>
)
: (
- <Button className="icon fluid text-left" onClick={this.subscribeOrUnsubscribe}>
+ <Button fluid={true} onClick={this.subscribeOrUnsubscribe}>
<i className="volume up icon" /> Subscribe
</Button>
);
diff --git a/public/pages/ShowIdea/components/ResponseForm.tsx b/public/pages/ShowIdea/components/ResponseForm.tsx
index c23d823d2..4ecc5a145 100644
--- a/public/pages/ShowIdea/components/ResponseForm.tsx
+++ b/public/pages/ShowIdea/components/ResponseForm.tsx
@@ -53,7 +53,7 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseFor
public render() {
const button = (
- <Button className="respond icon fluid text-left" onClick={async () => this.showModal()}>
+ <Button className="respond" fluid={true} onClick={async () => this.showModal()}>
<i className="announcement icon" /> Respond
</Button>
);
@@ -99,10 +99,10 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseFor
</div>
<div className="actions">
- <Button className="primary" onClick={() => this.submit()}>
+ <Button color="green" onClick={() => this.submit()}>
Submit
</Button>
- <Button className="basic" onClick={async () => this.closeModel()}>
+ <Button onClick={async () => this.closeModel()}>
Cancel
</Button>
</div>
diff --git a/public/pages/SignUp/SignUp.page.tsx b/public/pages/SignUp/SignUp.page.tsx
index 478f630f6..ccc0bb6b3 100644
--- a/public/pages/SignUp/SignUp.page.tsx
+++ b/public/pages/SignUp/SignUp.page.tsx
@@ -124,16 +124,14 @@ export class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState
{
this.user ?
- <div>
- <p>
- Hello, &nbsp;
- <b>{this.user.name}</b> {this.user.email && `(${this.user.email})`}
- </p>
- </div> :
- <div>
+ <p>
+ Hello, &nbsp;
+ <b>{this.user.name}</b> {this.user.email && `(${this.user.email})`}
+ </p> :
+ <>
<p>We need to identify you to setup your new Fider account.</p>
- <SignInControl auth={this.props.auth} signInByEmail={false} />
- <div className="ui form">
+ <SignInControl auth={this.props.auth} signInByEmail={false} />
+ <div className="ui form">
<DisplayError fields={['name', 'email']} error={this.state.error} />
<div className="fluid field">
<input id="name" onChange={(e) => this.setState({ name: e.currentTarget.value })} type="text" placeholder="your name" className="small" />
@@ -142,7 +140,7 @@ export class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState
<input id="email" onChange={(e) => this.setState({ email: e.currentTarget.value })} type="text" placeholder="[email protected]" className="small" />
</div>
</div>
- </div>
+ </>
}
<div className="ui section divider" />
@@ -193,7 +191,7 @@ export class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState
<p>Make sure information provided above is correct before proceeding.</p>
- <Button className="positive" size="large" onClick={() => this.confirm()}>Confirm</Button>
+ <Button color="green" size="large" onClick={() => this.confirm()}>Confirm</Button>
</div>
);
}
diff --git a/public/services/index.ts b/public/services/index.ts
index 0deebd5e5..73d8bd5f0 100644
--- a/public/services/index.ts
+++ b/public/services/index.ts
@@ -2,6 +2,7 @@ export * from './http';
export * from './cache';
export * from './analytics';
export * from './jwt';
+export * from './utils';
import * as page from './page';
import * as actions from './actions';
export { actions, page };
diff --git a/public/services/utils.ts b/public/services/utils.ts
new file mode 100644
index 000000000..89cc23628
--- /dev/null
+++ b/public/services/utils.ts
@@ -0,0 +1,16 @@
+export const delay = (ms: number) => {
+ return new Promise((resolve) => setTimeout(resolve, ms));
+};
+
+export const classSet = (input?: any): string => {
+ let classes = '';
+ if (input) {
+ for (const key in input) {
+ if (key && !!input[key]) {
+ classes += ` ${key}`;
+ }
+ }
+ return classes.trimLeft();
+ }
+ return '';
+};
diff --git a/tests/components/IdeaList.ts b/tests/components/IdeaList.ts
index 7c0b372ce..150952ef9 100644
--- a/tests/components/IdeaList.ts
+++ b/tests/components/IdeaList.ts
@@ -9,7 +9,7 @@ export class IdeaList {
}
public async want(index: number) {
- await (await this.elements)[index].findElement(By.css('.support-counter .button')).click();
+ await (await this.elements)[index].findElement(By.css('.c-support-counter button')).click();
}
public async navigateAndWait(index: number, condition: WaitCondition) {
@@ -18,7 +18,7 @@ export class IdeaList {
}
public async at(index: number): Promise<WebComponent> {
- const selector = '.support-counter .button';
+ const selector = '.c-support-counter button';
const counter = (await this.elements)[index].findElement(By.css(selector));
return new WebComponent(counter, selector);
}
diff --git a/tests/pages/AdminSettingsPage.ts b/tests/pages/AdminSettingsPage.ts
index 56f58ec39..55e17c1e7 100644
--- a/tests/pages/AdminSettingsPage.ts
+++ b/tests/pages/AdminSettingsPage.ts
@@ -19,7 +19,7 @@ export class AdminSettingsPage extends Page {
@findBy('#invitation')
public InvitationInput!: TextInput;
- @findBy('button.positive')
+ @findBy('button.green')
public ConfirmButton!: Button;
public loadCondition() {
diff --git a/tests/pages/HomePage.ts b/tests/pages/HomePage.ts
index 281ce6b77..c0598d3c8 100644
--- a/tests/pages/HomePage.ts
+++ b/tests/pages/HomePage.ts
@@ -26,7 +26,7 @@ export class HomePage extends Page {
@findBy('.ui.form textarea')
public IdeaDescription!: TextInput;
- @findBy('.ui.button.primary')
+ @findBy('.c-button.green')
public SubmitIdea!: Button;
@findBy('.signin')
@@ -38,10 +38,10 @@ export class HomePage extends Page {
@findBy('#signin-modal')
public SignInModal!: WebComponent;
- @findBy('#signin-modal .button.google')
+ @findBy('#signin-modal .c-button.google')
public GoogleSignIn!: Button;
- @findBy('#signin-modal .button.facebook')
+ @findBy('#signin-modal .c-button.facebook')
public FacebookSignIn!: Button;
@findBy('#email-signin input')
diff --git a/tests/pages/ShowIdeaPage.ts b/tests/pages/ShowIdeaPage.ts
index e2c62fb2f..4db0ab5e8 100644
--- a/tests/pages/ShowIdeaPage.ts
+++ b/tests/pages/ShowIdeaPage.ts
@@ -18,7 +18,7 @@ export class ShowIdeaPage extends Page {
@findBy('.fdr-response .content')
public ResponseText!: WebComponent;
- @findBy('.support-counter .button')
+ @findBy('.c-support-counter button')
public SupportCounter!: WebComponent;
@findBy('.comment-input textarea')
@@ -42,7 +42,7 @@ export class ShowIdeaPage extends Page {
@findBy('.ui.modal.active.fdr-response-form textarea')
private ResponseModalText!: TextInput;
- @findBy('.ui.modal.active.fdr-response-form .actions button.primary')
+ @findBy('.ui.modal.active.fdr-response-form .actions button.green')
private ResponseModalSubmitButton!: Button;
public loadCondition() {
diff --git a/tests/pages/SignUpPage.ts b/tests/pages/SignUpPage.ts
index d3dad09de..ec86a943f 100644
--- a/tests/pages/SignUpPage.ts
+++ b/tests/pages/SignUpPage.ts
@@ -10,31 +10,31 @@ export class SignUpPage extends Page {
return `http://login.dev.fider.io:3000/signup`;
}
- @findBy('#fdr-signup-page')
+ @findBy('#p-signup')
private Container!: WebComponent;
- @findBy('#fdr-signup-page .button.google')
+ @findBy('#p-signup .c-button.google')
public GoogleSignIn!: Button;
- @findBy('#fdr-signup-page .button.facebook')
+ @findBy('#p-signup .c-button.facebook')
public FacebookSignIn!: Button;
- @findBy('#fdr-signup-page .form #name')
+ @findBy('#p-signup .form #name')
public UserName!: TextInput;
- @findBy('#fdr-signup-page .form #email')
+ @findBy('#p-signup .form #email')
public UserEmail!: TextInput;
- @findBy('#fdr-signup-page .form #tenantName')
+ @findBy('#p-signup .form #tenantName')
public TenantName!: TextInput;
- @findBy('#fdr-signup-page .form #subdomain')
+ @findBy('#p-signup .form #subdomain')
public Subdomain!: TextInput;
- @findBy('#fdr-signup-page .button.positive')
+ @findBy('#p-signup .c-button.green')
public Confirm!: Button;
- @findBy('#fdr-signup-page .page .green.basic.label')
+ @findBy('#p-signup .page .green.basic.label')
private SubdomainOk!: WebComponent;
@findBy('#submitted-modal')