Skip to content

Commit

Permalink
Merge pull request elastic#10 from cchaos/maps-more-compressed/vector…
Browse files Browse the repository at this point in the history
…-styles

Maps more compressed -- Vector styles
  • Loading branch information
cchaos authored Sep 26, 2019
2 parents fee0699 + 9ed2601 commit 8ebd19d
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 91 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.mapColorStop {
position: relative;
padding-right: $euiSizeXL + $euiSizeXS;
padding-right: $euiSizeXL + $euiSizeS;

& + & {
margin-top: $euiSizeS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function StaticOrientationSelection({ onChange, styleOptions }) {
showInput
showLabels
compressed
append="°"
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { ValidatedDualRange } from 'ui/validated_range';
import { DEFAULT_MIN_SIZE, DEFAULT_MAX_SIZE } from '../../../vector_style_defaults';
import { i18n } from '@kbn/i18n';

export function SizeRangeSelector({ minSize, maxSize, onChange, ...rest }) {
const onSizeChange = ([min, max]) => {
Expand All @@ -23,10 +24,14 @@ export function SizeRangeSelector({ minSize, maxSize, onChange, ...rest }) {
max={DEFAULT_MAX_SIZE}
step={1}
value={[minSize, maxSize]}
showInput
showInput="inputWithPopover"
showRange
onChange={onSizeChange}
allowEmptyRange={false}
append={i18n.translate('xpack.maps.vector.dualSize.unitLabel', {
defaultMessage: 'px',
description: 'Shorthand for pixel',
})}
{...rest}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { staticSizeShape } from '../style_option_shapes';
import { ValidatedRange } from '../../../../../components/validated_range';
import { i18n } from '@kbn/i18n';

export function StaticSizeSelection({ onChange, styleOptions }) {
const onSizeChange = size => {
Expand All @@ -23,6 +24,10 @@ export function StaticSizeSelection({ onChange, styleOptions }) {
showInput
showLabels
compressed
append={i18n.translate('xpack.maps.vector.size.unitLabel', {
defaultMessage: 'px',
description: 'Shorthand for pixel',
})}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
EuiFlexGroup,
EuiFlexItem,
EuiFormRow,
EuiSelect,
EuiButtonGroup,
EuiSpacer,
EuiComboBox,
} from '@elastic/eui';
Expand All @@ -21,14 +21,14 @@ import { SymbolIcon } from './legend/symbol_icon';

const SYMBOLIZE_AS_OPTIONS = [
{
value: SYMBOLIZE_AS_CIRCLE,
text: i18n.translate('xpack.maps.vector.symbolAs.circleLabel', {
id: SYMBOLIZE_AS_CIRCLE,
label: i18n.translate('xpack.maps.vector.symbolAs.circleLabel', {
defaultMessage: 'circle marker',
}),
},
{
value: SYMBOLIZE_AS_ICON,
text: i18n.translate('xpack.maps.vector.symbolAs.IconLabel', {
id: SYMBOLIZE_AS_ICON,
label: i18n.translate('xpack.maps.vector.symbolAs.IconLabel', {
defaultMessage: 'icon',
}),
},
Expand All @@ -41,26 +41,27 @@ export function VectorStyleSymbolEditor({
isDarkMode,
}) {
const renderSymbolizeAsSelect = () => {
const selectedOption = SYMBOLIZE_AS_OPTIONS.find(({ value }) => {
return value === styleOptions.symbolizeAs;
const selectedOption = SYMBOLIZE_AS_OPTIONS.find(({ id }) => {
return id === styleOptions.symbolizeAs;
});

const onSymbolizeAsChange = e => {
const onSymbolizeAsChange = optionId => {
const styleDescriptor = {
options: {
...styleOptions,
symbolizeAs: e.target.value,
symbolizeAs: optionId,
},
};
handlePropertyChange('symbol', styleDescriptor);
};

return (
<EuiSelect
<EuiButtonGroup
buttonSize="compressed"
options={SYMBOLIZE_AS_OPTIONS}
value={selectedOption ? selectedOption.value : undefined}
idSelected={selectedOption ? selectedOption.id : undefined}
onChange={onSymbolizeAsChange}
compressed
isFullWidth
/>
);
};
Expand Down Expand Up @@ -113,28 +114,23 @@ export function VectorStyleSymbolEditor({
);
};

const renderFormRowContent = () => {
if (styleOptions.symbolizeAs === SYMBOLIZE_AS_CIRCLE) {
return renderSymbolizeAsSelect();
}

return (
<Fragment>
return (
<Fragment>
<EuiFormRow
label={i18n.translate('xpack.maps.vector.symbolLabel', {
defaultMessage: 'Symbol type',
})}
display="columnCompressed"
>
{renderSymbolizeAsSelect()}
<EuiSpacer size="s" />
{renderSymbolSelect()}
</Fragment>
);
};
</EuiFormRow>

return (
<EuiFormRow
label={i18n.translate('xpack.maps.vector.symbolLabel', {
defaultMessage: 'Symbol type',
})}
display="rowCompressed"
>
{renderFormRowContent()}
</EuiFormRow>
{styleOptions.symbolizeAs !== SYMBOLIZE_AS_CIRCLE && (
<Fragment>
<EuiSpacer size="s" />
{renderSymbolSelect()}
</Fragment>
)}
</Fragment>
);
}

0 comments on commit 8ebd19d

Please sign in to comment.