Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ npm-debug.log
dist
src/secrets.js
xunit.xml
coverage
coverage
.sass-cache/
33 changes: 33 additions & 0 deletions scss/components/card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.card {
header {
background-color: $linode-lightish-gray;
padding: 2rem;
}

.react-tabs {
[role=tablist] {
background-color: $linode-lightish-gray;
padding: 0 2rem;
border-color: $linode-gray;
}

[role=tab] {
color: $linode-dark-gray;
border-radius: 0;
margin-right: 1.5rem;
padding: 3px 12px;

&[selected],
&:hover {
color: $linode-black;
border-color: $linode-gray;
background: white;
border-bottom: 0;
}
}

[role=tabpanel] {
padding: 2rem;
}
}
}
11 changes: 6 additions & 5 deletions scss/components/dropdown.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.li-dropdown {
color: #999;
color: #555;
position: relative;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason for this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@na3d pointed out that the width of the dropdown's contents don't match up with the width of the dropdown. This fixes that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(with the help of other changes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. I wouldn't worry about this too much. It's too complex and arbitrary. I do not expect for much of the dropdown code to remain for long.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I was thinking that an overhaul of the dropdowns was probably necessary. Want to backlog it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

}

.li-dropdown-item.li-dropdown-first,
Expand All @@ -11,6 +12,7 @@
cursor: hand;
height: 29px;
line-height: 30px;
background: $linode-white;
}

.li-dropdown-activator {
Expand All @@ -25,15 +27,13 @@
}

.li-dropdown-body {
position: relative;
display: inline-block;

.li-dropdown-target {
display: none;
background: #fafafa;
border: $linode-border;
z-index: 9999;
width: 101px;
}

&:hover,
Expand All @@ -42,8 +42,9 @@
.li-dropdown-target {
display: block;
position: absolute;
top: 28px;
left: -71px;
top: 22px;
left: 0;
right: 0;
}
}
}
Expand Down
39 changes: 26 additions & 13 deletions scss/layout/linode-details.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,43 @@

header {
padding: 30px $side-margin 15px $side-margin;
line-height: 2.2rem;

h1 {
margin: 0;
font-size: 2.2rem;
}

.linode-status {
margin-left: 15px;
}

a {
padding-right: 30px;
margin-right: 1rem;
}

.li-dropdown-item.li-dropdown-first {
height: 30px;
}

.li-dropdown-body {
&:hover,
&:active,
&:focus {
.li-dropdown-target {
top: 29px;
left: -71px;
.edit-icon {
margin-left: 0.75rem;
font-size: 16px;
position: relative;
top: -6px;
}

.edit-details {
font-size: 2.2rem;
display: inline-block;

input {
background: transparent;
margin: 0 0.5rem;
padding: 0;
width: 12rem;
border: none;
border-bottom: $linode-border;

&:focus {
outline: none;
border-bottom-color: $linode-dark-gray;
}
}
}
Expand Down Expand Up @@ -89,4 +102,4 @@
.linode-performance {
padding: 15px $side-margin;
}
}
}
33 changes: 32 additions & 1 deletion scss/manager.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
$linode-blue: #4A90E2;
$linode-green: #3BB877;
$linode-red: #D0021B;
$linode-gray: #bfbfbf;
$linode-gray: #cccccc;
$linode-black: #4b4b4b;
$linode-dark-gray: #acacac;
$linode-white: #fefefe;
$linode-light-gray: #f9f9f9;
$linode-lightish-gray: #f3f3f3;
$linode-border: 1px solid $linode-gray;

$sidebar-width: 200px;
Expand All @@ -19,6 +20,7 @@ $nav-height: 84px;
@import 'layout/linode-details';
@import 'layout/linodes';
@import 'components/dropdown';
@import 'components/card';

* {
transition: background .35s, color .2s, border .1s;
Expand Down Expand Up @@ -275,6 +277,35 @@ nav {
}
}

button {
font-size: 2rem;
margin: 0 0.5rem;

&.btn {
text-decoration: none;
font-size: 10pt;
border-radius: 0;
border: $linode-border;
background: $linode-lightish-gray;
}

&.btn-primary.good {
background: $linode-blue;
border: 0;
}

&.btn-primary bad {
background: $linode-red;
border: 0;
}

&.btn-primary bad-secondary {
border-color: $linode-red;
background: transparent;
color: $linode-red;
}
}

.grid-list {
span {
padding-right: 5px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Dropdown(props) {

Dropdown.propTypes = {
elements: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
name: PropTypes.node.isRequired,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a node?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything you can render straight up. Any n that is valid for <span>{n}</span>.

action: PropTypes.func,
})).isRequired,
};
42 changes: 42 additions & 0 deletions src/linodes/actions/detail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { fetch } from '~/fetch';
import { UPDATE_LINODE } from '~/actions/api/linodes';

export const CHANGE_DETAIL_TAB = '@@linodes@@detail/CHANGE_DETAIL_TAB';
export const TOGGLE_EDIT_MODE = '@@linodes@@detail/TOGGLE_EDIT_MODE';
export const SET_LINODE_LABEL = '@@linodes@@detail/SET_LINODE_LABEL';
export const SET_LINODE_GROUP = '@@linodes@@detail/SET_LINODE_GROUP';
export const TOGGLE_LOADING = '@@linodes@@detail/TOGGLE_LOADING';

export function changeDetailTab(index) {
return { type: CHANGE_DETAIL_TAB, index };
}

export function toggleEditMode() {
return { type: TOGGLE_EDIT_MODE };
}

export function setLinodeLabel(label) {
return { type: SET_LINODE_LABEL, label };
}

export function setLinodeGroup(group) {
return { type: SET_LINODE_GROUP, group };
}

export function commitChanges(id) {
return async (dispatch, getState) => {
const state = getState();
const { label, group } = state.linodes.detail;
const { token } = state.authentication;
dispatch({ type: TOGGLE_LOADING });
// TODO: Error handling
const resp = await fetch(token, `/linodes/${id}`, {
method: 'PUT',
body: JSON.stringify({ label, group }),
});
const json = await resp.json();
dispatch({ type: UPDATE_LINODE, linode: json });
dispatch({ type: TOGGLE_LOADING });
dispatch(toggleEditMode());
};
}
Loading