Skip to content

Commit

Permalink
cal progress
Browse files Browse the repository at this point in the history
  • Loading branch information
snide committed Dec 15, 2017
1 parent ffc370c commit 52661c4
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 58 deletions.
1 change: 0 additions & 1 deletion src-docs/src/views/date_time/date_time.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {

export default () => (
<EuiDateTime>
<EuiDateTimeInput />
<EuiCalendar />
</EuiDateTime>
);
1 change: 1 addition & 0 deletions src-docs/src/views/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const iconTypes = [
'boxesVertical',
'brush',
'bullseye',
'calendar',
'check',
'clock',
'console',
Expand Down
16 changes: 16 additions & 0 deletions src/components/form/date_time/_date_time.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
.euiDateTime {
max-width: $euiFormMaxWidth;

.euiDateTime__input {
padding-right: $euiSizeXXL;
padding-left:$euiSizeM;
}

.euiDateTime__dateColumn {
padding: $euiSize;
}

.euiDateTime__timeColumn {
background: $euiColorLightestShade;
border-radius: 0 $euiBorderRadius $euiBorderRadius 0;
border-left: $euiBorderThin;
padding: $euiSize 0 $euiSize $euiSizeS;
}
}
3 changes: 0 additions & 3 deletions src/components/form/date_time/_date_time_input.scss

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/form/date_time/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import 'date_time';
@import 'date_time_input';
@import 'calendar/index';
@import 'time_selector/index';
32 changes: 31 additions & 1 deletion src/components/form/date_time/date_time.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import React, {
import PropTypes from 'prop-types';
import classNames from 'classnames';

import {
EuiCalendar,
EuiFormRow,
EuiFieldText,
EuiPanel,
EuiFlexGroup,
EuiFlexItem,
EuiTimeSelector,
} from '../../../components';

export class EuiDateTime extends Component {
static propTypes = {
children: PropTypes.node,
Expand Down Expand Up @@ -31,7 +41,27 @@ export class EuiDateTime extends Component {
className={classes}
{...rest}
>
{children}
<EuiFormRow
id="asdf"
label="Calendar"
>
<EuiFieldText
icon="calendar"
iconSide="right"
className="euiDateTime__input"
value="12/13/2017 01:02:03 PM"
/>
</EuiFormRow>
<EuiPanel hasShadow paddingSize="none">
<EuiFlexGroup gutterSize="none">
<EuiFlexItem grow={false} className="euiDateTime__dateColumn">
<EuiCalendar />
</EuiFlexItem>
<EuiFlexItem className="euiDateTime__timeColumn">
<EuiTimeSelector />
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</div>
);
}
Expand Down
44 changes: 0 additions & 44 deletions src/components/form/date_time/date_time_input.js

This file was deleted.

8 changes: 4 additions & 4 deletions src/components/form/date_time/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ export {
EuiDateTime,
} from './date_time';

export {
EuiDateTimeInput,
} from './date_time_input';

export {
EuiCalendar,
EuiCalendarMonthYearSelector,
EuiCalendarGrid,
EuiCalendarGridItem,
} from './calendar';

export {
EuiTimeSelector,
} from './time_selector';
1 change: 1 addition & 0 deletions src/components/form/date_time/time_selector/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'time_selector';
22 changes: 22 additions & 0 deletions src/components/form/date_time/time_selector/_time_selector.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.euiTimeSelector {
@include euiScrollBar;
max-height: 256px;
overflow-y: auto;

.euiTimeSelector__button {
display: block;
font-size: $euiFontSizeXS;
color: $euiColorDarkShade;
padding: $euiSizeXS / 2 $euiSizeXS;
text-align: right;
width: 100%;
border: $euiBorderThin;
border-color: transparent;

&:focus {
background: $euiColorEmptyShade;
border-color: $euiColorPrimary;
color: $euiColorPrimary;
}
}
}
3 changes: 3 additions & 0 deletions src/components/form/date_time/time_selector/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export {
EuiTimeSelector,
} from './time_selector';
61 changes: 61 additions & 0 deletions src/components/form/date_time/time_selector/time_selector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

export const EuiTimeSelector = ({
children,
className,
...rest,
}) => {
const classes = classNames('euiTimeSelector', className);

const times = [
'12:00 AM',
'12:30 AM',
'1:00 AM',
'1:30 AM',
'2:00 AM',
'2:30 AM',
'3:00 AM',
'3:30 AM',
'4:00 AM',
'4:30 AM',
'5:00 AM',
'5:30 AM',
'6:00 AM',
'6:30 AM',
'7:00 AM',
'7:30 AM',
'8:00 AM',
'8:30 AM',
]

const timeListItems = (
times.map((time, index) => {
return (
<li
key={index}
>
<button className="euiTimeSelector__button">
{time}
</button>
</li>
);
})
);


return (
<ul
className={classes}
{...rest}
>
{timeListItems}
</ul>
);
};

EuiTimeSelector.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from 'react';
import { render } from 'enzyme';
import { requiredProps } from '../../test';

import { EuiDateTimeInput } from './date_time_input';
import { EuiTimeSelector } from './time_selector';

describe('EuiDateTimeInput', () => {
describe('EuiTimeSelector', () => {
test('is rendered', () => {
const component = render(
<EuiDateTimeInput {...requiredProps} />
<EuiTimeSelector {...requiredProps} />
);

expect(component)
Expand Down
4 changes: 4 additions & 0 deletions src/components/form/field_text/field_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const EuiFieldText = ({
value,
className,
icon,
iconSide,
isInvalid,
inputRef,
fullWidth,
Expand All @@ -34,6 +35,7 @@ export const EuiFieldText = ({
icon={icon}
fullWidth={fullWidth}
isLoading={isLoading}
iconSide={iconSide}
>
<EuiValidatableControl
isInvalid={isInvalid}
Expand All @@ -59,6 +61,7 @@ EuiFieldText.propTypes = {
placeholder: PropTypes.string,
value: PropTypes.string,
icon: PropTypes.string,
iconSide: PropTypes.string,
isInvalid: PropTypes.bool,
inputRef: PropTypes.func,
fullWidth: PropTypes.bool,
Expand All @@ -69,4 +72,5 @@ EuiFieldText.defaultProps = {
value: undefined,
fullWidth: false,
isLoading: false,
iconSide: 'left',
};
2 changes: 1 addition & 1 deletion src/components/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export {
} from './checkbox';
export {
EuiDateTime,
EuiDateTimeInput,
EuiCalendar,
EuiCalendarGrid,
EuiCalendarGridItem,
EuiCalendarMonthYearSelector,
EuiTimeSelector,
} from './date_time';
export { EuiFieldNumber } from './field_number';
export { EuiFieldPassword } from './field_password';
Expand Down
8 changes: 8 additions & 0 deletions src/components/icon/assets/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/icon/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import alert from './assets/alert.svg';
import addDataApp from './assets/app_add_data.svg';
import advancedSettingsApp from './assets/app_advanced_settings.svg';
import apmApp from './assets/app_apm.svg';
import calendar from './assets/calendar.svg';
import consoleApp from './assets/app_console.svg';
import dashboardApp from './assets/app_dashboard.svg';
import devToolsApp from './assets/app_devtools.svg';
Expand Down Expand Up @@ -103,6 +104,7 @@ const typeToIconMap = {
boxesVertical,
brush,
bullseye,
calendar,
check,
clock,
console,
Expand Down
1 change: 1 addition & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export {
EuiSelect,
EuiSwitch,
EuiTextArea,
EuiTimeSelector,
EuiValidatableControl,
} from './form';

Expand Down

0 comments on commit 52661c4

Please sign in to comment.