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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cx from 'classnames';
import get from 'get-value';

import withIntlAsProp from '../../../../../utils/withIntlAsProp';
import style from '../style.css';

class BinaryDeviceState extends Component {
handleValueChangeBinary = newValue => () => {
Expand All @@ -16,9 +17,9 @@ class BinaryDeviceState extends Component {
const customText = get(this.props.intl.dictionary, `deviceFeatureValue.category.${category}.${type}`);

return (
<div class="col-6">
<div class="col-6 d-flex">
<button
class={cx('btn', 'btn-block', 'p-1', {
class={cx('btn', 'btn-block', 'p-1', style.deviceStateButton, {
'btn-primary': this.props.trigger.value === value,
'btn-outline-primary': this.props.trigger.value !== value,
active: this.props.trigger.value === value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Component } from 'preact';
import { Text } from 'preact-i18n';
import cx from 'classnames';

import style from '../style.css';

class DoorbellRingDeviceState extends Component {
componentWillMount() {
Expand All @@ -22,8 +25,8 @@ class DoorbellRingDeviceState extends Component {

render() {
return (
<div class="col-6">
<button class="btn btn-block btn-secondary" disabled>
<div class="col-6 d-flex">
<button class={cx('btn', 'btn-block', 'btn-secondary', style.deviceStateButton)} disabled>
<Text id="editScene.triggersCard.newState.doorbellRang" />
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Component } from 'preact';
import { Text } from 'preact-i18n';
import cx from 'classnames';

import style from '../style.css';

class PresenceSensorDeviceState extends Component {
componentWillMount() {
Expand All @@ -22,8 +25,8 @@ class PresenceSensorDeviceState extends Component {

render() {
return (
<div class="col-6">
<button class="btn btn-block btn-secondary" disabled>
<div class="col-6 d-flex">
<button class={cx('btn', 'btn-block', 'btn-secondary', style.deviceStateButton)} disabled>
<Text id="editScene.triggersCard.newState.deviceSeen" />
</button>
</div>
Expand Down
13 changes: 13 additions & 0 deletions front/src/routes/scene/edit-scene/triggers/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@
margin-top: 12px;
}
}

/* The theme ships `white-space: nowrap` on `.btn`: in the "device state change"
trigger the state buttons have a fixed column width, so a long label
("Mouvement détecté", "Pas de mouvement", and their equivalent in other
languages) overflows the button instead of being displayed. Let the label
wrap on several lines, and stretch the button to the height of its column so
a pair of buttons stays aligned when only one of them wraps. */
.deviceStateButton {
flex: 1;
height: 100%;
white-space: normal;
overflow-wrap: anywhere;
}
Loading