Skip to content

Commit

Permalink
Merge branch 'release-2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Jan 29, 2019
2 parents 35512ba + 6786616 commit b3c3053
Show file tree
Hide file tree
Showing 31 changed files with 450 additions and 428 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.0] (2019-01-29)

### Added

* [#659](https://github.com/dadi/publish/pull/659): add support for custom CSS in workspace directory

## [2.0.3] (2019-01-09)

### Fixed
Expand Down
29 changes: 29 additions & 0 deletions frontend/components/BulkActionSelector/BulkActionSelector.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.container {
display: flex;
margin-top: 10px;
width: 100%;
}

.container-empty {
display: none;
}

.dropdown {
flex-grow: 1;
margin-right: 10px;
}

@media (--breakpoint-medium) {
.container {
margin-top: 0;
width: auto;
}

.container-empty {
display: block;
}

.dropdown {
min-width: 130px;
}
}
104 changes: 104 additions & 0 deletions frontend/components/BulkActionSelector/BulkActionSelector.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
'use strict'

import {h, Component} from 'preact'
import proptypes from 'proptypes'

import Style from 'lib/Style'
import styles from './BulkActionSelector.css'

import ButtonWithPrompt from 'components/ButtonWithPrompt/ButtonWithPrompt'
import DropdownNative from 'components/DropdownNative/DropdownNative'

const ACTION_PLACEHOLDER = 'ACTION_PLACEHOLDER'

/**
* A dropdown + button to apply actions to a series of elements.
*/
export default class BulkActionSelector extends Component {
static propTypes = {
/**
* List of possible actions. Must be an object mapping action IDs
* to action labels.
*/
actions: proptypes.object,

/**
* Classes to append to the element.
*/
className: proptypes.string,

/**
* Callback to be executed when a value is selected.
*/
onChange: proptypes.func,

/**
* Array of selected elements.
*/
selection: proptypes.array
}

constructor(props) {
super(props)

this.state.selected = ACTION_PLACEHOLDER
}

onApply() {
const {onChange} = this.props
const {selected} = this.state

if (!selected || selected === ACTION_PLACEHOLDER) return

if (typeof onChange === 'function') {
onChange.call(this, selected)
}
}

onChange(value) {
this.setState({
selected: value
})
}

render() {
const {
actions,
className,
onChange,
selection = []
} = this.props
const {selected} = this.state
const containerStyle = new Style(styles, 'container')
.addIf('container-empty', selection.length === 0)
.addResolved(className)
let placeholder = 'With selected'

if (selection.length > 0) {
placeholder += ` (${selection.length})`
}

return (
<div class={containerStyle.getClasses()}>
<DropdownNative
className={styles.dropdown}
onChange={this.onChange.bind(this)}
options={actions}
placeholderLabel={placeholder}
placeholderValue={ACTION_PLACEHOLDER}
textSize="small"
value={selected}
/>

<ButtonWithPrompt
accent="data"
disabled={(selected === ACTION_PLACEHOLDER) || !selection.length}
onClick={this.onApply.bind(this)}
promptCallToAction={`Yes, delete ${selection.length > 1 ? 'them' : 'it'}.`}
promptMessage={`Are you sure you want to delete the selected ${selection.length > 1 ? 'documents' : 'document'}?`}
size="small"
>Apply</ButtonWithPrompt>
</div>
)
}
}
50 changes: 10 additions & 40 deletions frontend/components/Button/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@
font-size: 15px;
text-decoration: none;
border-radius: 2px;
transition: background-color 0.1s, padding 0.3s, background-position 0.3s;
transition: background-color 0.1s,
box-shadow 0.1s,
padding 0.3s,
background-position 0.3s;
position: relative;
}

.button:hover {
box-shadow: 0 -3px 0 0 rgba(0,0,0,0.05) inset, 0 0 5px 0px rgba(0,0,0,0.15);
box-shadow: 10000px 0 0 rgba(0,0,0,0.1) inset,
0 -3px 0 0 rgba(0,0,0,0.05) inset,
0 0 5px 0px rgba(0,0,0,0.15);
}
.button:active {
top: 1px;
Expand Down Expand Up @@ -76,14 +81,7 @@
/* Accent: system */
.button-system {
background-color: var(--theme-colour-system, #ffbf0d);
color: var(--theme-colour-primary, #000000);
}

.button-system:active,
.button-system:focus,
.button-system:hover {
background-color: var(--theme-colour-system-shade-1, #d9a000);
color: var(--theme-colour-system, #ffbf0d);
color: var(--theme-colour-system-invert, #000000);
}

/* Accent: destruct */
Expand All @@ -93,58 +91,30 @@
color: var(--theme-colour-secondary, #FFFFFF);
}

.button-destruct:active,
.button-destruct:focus,
.button-destruct:hover {
background-color: var(--theme-colour-error-shade-1, #d9a000);
color: var(--theme-colour-secondary, #FFFFFF);
}

/* Accent: save */
.button-save {
background-color: var(--theme-colour-save, #88c24c);
background-image: url(./loading-small-white.svg);
color: var(--theme-colour-secondary, #FFFFFF);
}

.button-save:active,
.button-save:focus,
.button-save:hover {
background-color: var(--theme-colour-save-shade-1, #6ea338);
color: var(--theme-colour-secondary, #FFFFFF);
}

/* Accent: data */
.button-data {
background-color: var(--theme-colour-data, #4A91FF);
background-image: url(./loading-small-white.svg);
color: var(--theme-colour-secondary, #FFFFFF);
}

.button-data:active,
.button-data:focus,
.button-data:hover {
background-color: var(--theme-colour-data-shade-1, #1772ff);
color: var(--theme-colour-secondary, #FFFFFF);
}

/* Accent: neutral */
.button-neutral {
box-shadow: 0 0 0 1px #EAEAEA inset;
background-color: var(--theme-colour-background, #FFFFFF);
color: var(--theme-colour-primary, #000000);
}

.button-neutral:active,
.button-neutral:focus,
.button-neutral:hover {
box-shadow: 0 0 0 1px rgba(0,0,0,0.1) inset;
background-color: var(--theme-colour-data-shade-1, #1772ff);
color: var(--theme-colour-secondary, #FFFFFF);
}

/* Disabled */
.button[disabled]:not(.button-inherit) {
.button[disabled]:not(.button-inherit),
.button-disabled:not(.button-inherit) {
background-color: var(--theme-colour-background-shade-2, #AAAAAA) !important;
color: var(--theme-colour-secondary, #FFFFFF) !important;
cursor: not-allowed !important;
Expand Down
1 change: 1 addition & 0 deletions frontend/components/Button/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default class Button extends Component {
const buttonStyle = new Style(styles, 'button')

buttonStyle.add(`button-${accent}`)
.addIf('button-disabled', disabled)
.addIf('button-loading', isLoading)
.addIf(`button-in-group-${inGroup}`, inGroup)
.addIf('button-mock', type === 'mock')
Expand Down
3 changes: 1 addition & 2 deletions frontend/components/DocumentFilters/DocumentFilters.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
position: relative;
display: flex;
justify-content: space-between;
align-items: flex-start;
align-items: center;
}

@media (--breakpoint-small) {
Expand All @@ -23,7 +23,6 @@
.filters {
order: 3;
width: 100%;
margin-top: 5px;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
.wrapper {
border-top: 1px solid #282f39;
background-image: linear-gradient(-180deg, #0b131f 10%, #17273f 100%);
display: flex;
padding: 15px 20px;
align-items: center
}

.actions {
margin-bottom: 10px;
margin-left: 10px;
}

@media (--breakpoint-medium) {
.actions {
margin-bottom: 0;
margin-left: 0;
padding-left: 10px;
}

Expand All @@ -20,6 +22,19 @@

.filters {
flex-grow: 1;
order: -1;
}
}

.new-button-large {
display: none;
}

@media (--breakpoint-medium) {
.new-button-large {
display: block;
}

.new-button-small {
display: none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ export default class DocumentListController extends Component {

return (
<div class={styles.wrapper}>
<div class={styles.actions}>
{createNewHref &&
<Button
accent="save"
href={createNewHref}
type="fill"
>Create new</Button>
}
</div>

<div class={styles.filters}>
{enableFilters &&
<DocumentFilters
Expand All @@ -82,6 +72,28 @@ export default class DocumentListController extends Component {
/>
}
</div>

<div class={styles.actions}>
{createNewHref &&
<div class={styles['new-button-large']}>
<Button
accent="save"
href={createNewHref}
type="fill"
>Create new</Button>
</div>
}

{createNewHref &&
<div class={styles['new-button-small']}>
<Button
accent="save"
href={createNewHref}
type="fill"
>New</Button>
</div>
}
</div>
</div>
)
}
Expand Down
Loading

0 comments on commit b3c3053

Please sign in to comment.