diff --git a/browser/styles/main/HomeContainer/lib/Preferences.styl b/browser/styles/main/HomeContainer/lib/Preferences.styl index 104948d8..cb74597a 100644 --- a/browser/styles/main/HomeContainer/lib/Preferences.styl +++ b/browser/styles/main/HomeContainer/lib/Preferences.styl @@ -451,8 +451,11 @@ iptFocusBorderColor = #369DCD overflow ellipsis .folderControl float right - width 145px + width 125px text-align center + &.folderHeader + .folderName + padding-left 25px &.newFolder .alert display block @@ -502,6 +505,30 @@ iptFocusBorderColor = #369DCD &:hover color lighten(brandColor, 10%) &.FolderRow + .sortBtns + float left + display block + height 30px + width 30px + margin-top 1.5px + position absolute + button + absolute left + background-color transparent + border none + height 15px + padding 0 + margin 0 + color stripBtnColor + &:first-child + top 0 + &:last-child + top 15px + &:hover + color stripHoverBtnColor + &:disabled + color lighten(stripBtnColor, 10%) + cursor not-allowed .folderName input height 33px border 1px solid borderColor @@ -555,9 +582,9 @@ iptFocusBorderColor = #369DCD &:hover border-color borderColor &.active + border-color iptFocusBorderColor .FolderMark transform scale(1.4) - border-color iptFocusBorderColor .folderControl button border none diff --git a/lib/actions.js b/lib/actions.js index d99aa2e4..ebbc47ac 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -4,6 +4,7 @@ export const ARTICLE_DESTROY = 'ARTICLE_DESTROY' export const FOLDER_CREATE = 'FOLDER_CREATE' export const FOLDER_UPDATE = 'FOLDER_UPDATE' export const FOLDER_DESTROY = 'FOLDER_DESTROY' +export const FOLDER_REPLACE = 'FOLDER_REPLACE' export const SWITCH_FOLDER = 'SWITCH_FOLDER' export const SWITCH_MODE = 'SWITCH_MODE' @@ -57,6 +58,16 @@ export function destroyFolder (key) { } } +export function replaceFolder (a, b) { + return { + type: FOLDER_REPLACE, + data: { + a, + b + } + } +} + export function switchFolder (folderName) { return { type: SWITCH_FOLDER, diff --git a/lib/components/modal/Preference/FolderRow.js b/lib/components/modal/Preference/FolderRow.js index d19388d5..8fba0d37 100644 --- a/lib/components/modal/Preference/FolderRow.js +++ b/lib/components/modal/Preference/FolderRow.js @@ -2,7 +2,7 @@ import React, { PropTypes } from 'react' import linkState from 'boost/linkState' import FolderMark from 'boost/components/FolderMark' import store from 'boost/store' -import { updateFolder, destroyFolder } from 'boost/actions' +import { updateFolder, destroyFolder, replaceFolder } from 'boost/actions' const IDLE = 'IDLE' const EDIT = 'EDIT' @@ -17,6 +17,20 @@ export default class FolderRow extends React.Component { } } + handleUpClick (e) { + let { index } = this.props + if (index > 0) { + store.dispatch(replaceFolder(index, index - 1)) + } + } + + handleDownClick (e) { + let { index, count } = this.props + if (index < count - 1) { + store.dispatch(replaceFolder(index, index + 1)) + } + } + handleCancelButtonClick (e) { this.setState({ mode: IDLE @@ -141,6 +155,10 @@ export default class FolderRow extends React.Component { default: return (