Skip to content

Commit 66388ee

Browse files
author
Tomasz Opalach
committed
[client] HRInternal-347 confirmation window style fixes
1 parent dda42dc commit 66388ee

File tree

8 files changed

+71
-40
lines changed

8 files changed

+71
-40
lines changed

DemoServer/client/src/components/helpers/Markdown.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class Markdown extends React.Component<{}, {}> {
1313
this.markdown.SafeMode = false;
1414
}
1515

16-
render() {
16+
public render() {
1717
const { children } = this.props;
1818
if (!children) {
1919
return null;
@@ -22,4 +22,4 @@ export class Markdown extends React.Component<{}, {}> {
2222
const html = this.markdown.Transform(children);
2323
return <RawHtml>{html}</RawHtml>;
2424
}
25-
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as React from "react";
22

33
export class RawHtml extends React.Component<{}, {}> {
4-
rawInput() {
4+
private _rawInput() {
55
const input = this.props.children as string;
66
return { __html: input };
77
}
88

9-
render() {
10-
return <span dangerouslySetInnerHTML={this.rawInput()}></span>
9+
public render() {
10+
return <span dangerouslySetInnerHTML={this._rawInput()}></span>;
1111
}
12-
}
12+
}

DemoServer/client/src/components/home/index.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ type Props = StateProps & DispatchProps;
2222

2323
class HomeComponent extends React.Component<Props, {}> {
2424

25-
componentDidMount() {
25+
public componentDidMount() {
2626
this.props.getContext();
2727
}
2828

29-
getCategoryElement(category: CategoryHeaderDto, index: number) {
29+
private _getCategoryElement(category: CategoryHeaderDto, index: number) {
3030
const { progress } = this.props;
3131
const completedForCategory = progress
3232
&& progress.completedDemos
@@ -38,21 +38,21 @@ class HomeComponent extends React.Component<Props, {}> {
3838
/>;
3939
}
4040

41-
demoList() {
41+
private _demoList() {
4242
const { categories } = this.props;
4343

4444
return <div className="demo-list">
45-
{categories.map((x, i) => this.getCategoryElement(x, i))}
45+
{categories.map((x, i) => this._getCategoryElement(x, i))}
4646
</div>;
4747
}
4848

49-
render() {
49+
public render() {
5050
const { loading } = this.props;
5151

5252
return <>
5353
<div className="header-image"><h1>Dive into RavenDB</h1></div>
5454
<Spinner show={loading} />
55-
{!loading && this.demoList()}
55+
{!loading && this._demoList()}
5656
</>;
5757
}
5858
}

DemoServer/client/src/components/layout/dialogs/Dialog.tsx

+12-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ export class Dialog extends React.Component<DialogProps, {}> {
2121
export class ButtonPanel extends React.Component<{}, {}> {
2222
public render() {
2323
return <div className="text-center margin-top">
24-
{this.props.children}
24+
<div className="btn-group">
25+
{this.props.children}
26+
</div>
2527
</div>;
2628
}
2729
}
@@ -36,7 +38,15 @@ export const CancelButton = (props: DialogButtonProps) => {
3638
const { text, onClick, disabled } = props;
3739

3840
return <button className="btn btn-default" onClick={onClick} disabled={disabled}>
39-
<IconCancel /> {text || "No"}
41+
<IconCancel /> {text || "Cancel"}
42+
</button>;
43+
};
44+
45+
export const AcceptButton = (props: DialogButtonProps) => {
46+
const { text, onClick, disabled } = props;
47+
48+
return <button className="btn btn-danger" onClick={onClick} disabled={disabled}>
49+
<IconReload /> {text || "Yes"}
4050
</button>;
4151
};
4252

DemoServer/client/src/components/layout/dialogs/ResetDatabaseConfirm.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import { connect } from "react-redux";
33
import { AppState } from "../../../store/state";
4-
import { Dialog, ButtonPanel, CancelButton, ReloadButton } from "./Dialog";
4+
import { Dialog, ButtonPanel, CancelButton, AcceptButton } from "./Dialog";
55
import { DemoThunkDispatch } from "../../../store";
66
import { closeResetDatabaseDialog, resetDatabase } from "../../../store/actions/settings";
77

@@ -22,11 +22,14 @@ const ResetDatabaseConfirmComponent = (props: Props) => {
2222

2323
return <Dialog show={show}>
2424
<h2>Reset Demo Database</h2>
25-
<p>Are you sure you want to reset your demo database?</p>
26-
<p>Your demo progress won't be affected.</p>
25+
<p>
26+
This will delete all custom data saved while using the demo,
27+
and revert individual demo database to its starting point.
28+
</p>
29+
<p>Your demo progress will not be affected.</p>
2730
<ButtonPanel>
2831
<CancelButton onClick={onCancel} disabled={buttonsDisabled} />
29-
<ReloadButton text="Yes" onClick={onConfirm} disabled={buttonsDisabled} />
32+
<AcceptButton text="Reset Demo Database" onClick={onConfirm} disabled={buttonsDisabled} />
3033
</ButtonPanel>
3134
</Dialog>;
3235
};

DemoServer/client/src/components/layout/dialogs/ResetProgressConfirm.tsx

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import { connect } from "react-redux";
33
import { AppState } from "../../../store/state";
4-
import { Dialog, ButtonPanel, CancelButton, ReloadButton } from "./Dialog";
4+
import { Dialog, ButtonPanel, CancelButton, AcceptButton } from "./Dialog";
55
import { closeResetProgressDialog, resetProgress } from "../../../store/actions/settings";
66
import { DemoThunkDispatch } from "../../../store";
77

@@ -20,15 +20,12 @@ const ResetProgressConfirmComponent = (props: Props) => {
2020
const { show, onConfirm, onCancel } = props;
2121

2222
return <Dialog show={show}>
23-
<h2>Mark All Demos as Not Run</h2>
24-
<p>
25-
Are you sure you want to mark all demos as not run?
26-
This will reset your demo progress.
27-
</p>
23+
<h2>Mark All Demos as Not Completed</h2>
24+
<p>This will reset your demo progress and mark all demos as "not completed".</p>
2825
<p>Your demo database won't be modified.</p>
2926
<ButtonPanel>
3027
<CancelButton onClick={onCancel} />
31-
<ReloadButton text="Yes" onClick={onConfirm} />
28+
<AcceptButton text="Mark Demos as Not Completed" onClick={onConfirm} />
3229
</ButtonPanel>
3330
</Dialog>;
3431
};

DemoServer/client/src/components/layout/header/settings/MainSettingsItems.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MainSettingsItemsComponent extends React.Component<DispatchProps, {}> {
1515

1616
return <>
1717
<a className="dropdown-item" onClick={resetDatabase}>Reset Demo Database</a>
18-
<a className="dropdown-item" onClick={resetUserProgress}>Mark all demos as not run</a>
18+
<a className="dropdown-item" onClick={resetUserProgress}>Mark all demos as not completed</a>
1919
</>;
2020
}
2121
}

DemoServer/client/styles/basic-layout.scss

+35-14
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,28 @@ hr {
104104
flex-grow: 1;
105105
}
106106

107+
.btn-group {
108+
display: flex;
109+
align-items: center;
110+
justify-content: center;
111+
flex-wrap: wrap;
112+
margin: $gutter-xs/-2;
113+
114+
.btn {
115+
margin: $gutter-xs/2;
116+
}
117+
}
118+
119+
@mixin btn-variant($text-color, $background-color) {
120+
background-color: $background-color;
121+
color: $text-color;
122+
123+
&:hover, &:active {
124+
background-color: saturate( darken( $background-color, 5% ), 0% );
125+
color: saturate( lighten( $text-color, 10% ), 40% );
126+
}
127+
}
128+
107129
.btn {
108130
border: none;
109131
background-color: $gray-base;
@@ -118,27 +140,25 @@ hr {
118140
margin-right: $gutter-xxs;
119141
}
120142

121-
&:hover {
122-
background-color: $gray-dark;
123-
color: saturate( lighten( $brand-primary, 10% ), 40% );
143+
&.btn-primary {
144+
@include btn-variant($gray-lighter, $brand-primary);
124145
}
125146

126-
&.active {
127-
background-color: $brand-primary;
128-
color: $gray-lighter;
147+
&.btn-danger {
148+
@include btn-variant($gray-lighter, $brand-danger-dark);
129149
}
130-
131-
&.btn-primary {
132-
150+
151+
&.btn-success {
152+
@include btn-variant($gray-darker, $brand-success-dark);
133153
}
134154

135155
&.btn-default {
136-
background-color: rgba($gray-lighter, .8);
137-
color: $gray-dark;
156+
@include btn-variant($gray-dark, rgba($gray-lighter, .8));
157+
}
138158

139-
&:hover {
140-
background-color: $gray-lighter;
141-
}
159+
&:disabled {
160+
background-color: $gray !important;
161+
color: $gray-light !important;
142162
}
143163
}
144164

@@ -757,6 +777,7 @@ $spin-properties: spin .75s infinite cubic-bezier(0.6, 0.02, 0.4, 0.99);
757777
border-radius: 3px;
758778
box-shadow: 0px 5px 20px 0px #000;
759779
padding: $gutter;
780+
max-width: 400px;
760781

761782
h2 {
762783
margin: 0;

0 commit comments

Comments
 (0)