Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add eventrow to stories with knob to change hide calendar #362

Merged
merged 4 commits into from
Nov 19, 2017
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
3 changes: 2 additions & 1 deletion client/src/components/ErrorShow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react';
import React from 'react';
import PropTypes from 'prop-types';

const ErrorShow = ({ msg }) => (
<span>
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Register.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { PropTypes } from 'react';
import React from 'react';
import { Link, withRouter } from 'react-router';
import Modal from 'react-modal';
import PropTypes from 'prop-types';
import Terms from './Terms';

class Register extends React.Component {
Expand Down
9 changes: 5 additions & 4 deletions client/src/utils/dateFormatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import moment from 'moment-timezone';
export function getFormattedDayAndTime(date, endDate) {
const localTimezone = moment.tz.guess();

const startDateMoment = moment(date);
const startDateMoment = moment(date).tz(localTimezone);
const endDateMoment = moment(endDate).tz(localTimezone);
const day = startDateMoment.format('dddd, MMMM D, YYYY');
const start = moment(date).tz(localTimezone).format('h:mm');
const end = moment(endDate).tz(localTimezone).format('h:mm a z');
const startTime = startDateMoment.format('h:mm');
const endTime = endDateMoment.format('h:mm a z');
return {
day,
time: `${start}-${end}`
time: `${startTime}-${endTime}`
};
}

Expand Down
5 changes: 5 additions & 0 deletions client/stories/__tests__/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"globals": {
"jest": true
}
}
59 changes: 58 additions & 1 deletion client/stories/__tests__/__snapshots__/storyshots.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`Storyshots Event Event with customizable props 1`] = `
<h4>
Tuesday, January 1, 1901
|
4:00-7:30 pm UTC
11:00-2:30 am GMT
</h4>
<p>
Galvanize, Golden Triangle, Denver
Expand Down Expand Up @@ -75,6 +75,63 @@ exports[`Storyshots Event Event with customizable props 1`] = `
</div>
`;

exports[`Storyshots EventRow Event row with customizable props 1`] = `
<div
className="row event-row"
>
<div
className="small-12 medium-2 columns"
>
Monday, January 1, 2018
</div>
<div
className="small-12 medium-2 columns"
>
12:00-12:00 am GMT
</div>
<div
className="small-12 medium-5 columns"
>
music

denver
</div>
<div
className="small-12 medium-1 columns"
>
<a
onClick={[Function]}
style={Object {}}
>
details
</a>
</div>
<div
className="small-12 medium-2 columns"
>
<div
className="react-add-to-calendar"
>
<div
className="react-add-to-calendar__wrapper"
>
<a
className="react-add-to-calendar__button"
onClick={[Function]}
>
<span>
add to calendar
<i
className="react-add-to-calendar__icon--right fa fa-caret-down"
/>
</span>
</a>
</div>
</div>
</div>
</div>
`;

exports[`Storyshots Header Logged In: Organizer 1`] = `
<header
className="top-bar"
Expand Down
4 changes: 4 additions & 0 deletions client/stories/__tests__/storyshots.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import initStoryshots from 'storyshots';
import moment from 'moment-timezone';

moment.tz.setDefault('Europe/London');
moment.tz.guess = jest.fn(() => 'Europe/London');

initStoryshots({
configPath: 'client/stories/snapshotConfig'
Expand Down
5 changes: 3 additions & 2 deletions client/stories/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ storiesOf('Event', module)
'Check the knobs tab in the panel below to customize the props for this component',
() => {
const eventData = {
date: date('data.date', new Date('Jan 1, 1901 4:00 pm')),
endDate: date('data.endDate', new Date('Jan 1, 1901 7:30 pm')),
date: date('data.date', new Date('Jan 1, 1901 4:00 pm MST')),
endDate: date('data.endDate', new Date('Jan 1, 1901 7:30 pm MST')),
id: 2,
location: text('data.location', 'Galvanize, Golden Triangle, Denver'),
name: text('data.name', 'The best event'),
Expand All @@ -38,6 +38,7 @@ storiesOf('Event', module)
isRegistered={boolean('is Registered', false)}
signUpForEvent={action('sign up for event')}
cancelSignUpForEvent={action('cancel sign up for event')}
deleteEvent={action('delete event')}
/>
);
}
Expand Down
22 changes: 22 additions & 0 deletions client/stories/eventrow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import { withKnobs, boolean } from '@kadira/storybook-addon-knobs';
import EventRow from '../src/components/EventRow';

storiesOf('EventRow', module)
.addDecorator(withKnobs)
.addWithInfo(
'Event row with customizable props',
'Check the knobs tab in the panel below to customize the props for this component',
() => (
<EventRow
hideCalendar={boolean('hide calendar', false)}
event={{
date: '2018-01-01',
endDate: '2018-01-02',
id: 5,
location: 'denver',
name: 'music' }}
/>
)
);
1 change: 1 addition & 0 deletions client/stories/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '../src/scss/app.scss';
import './header';
import './event';
import './eventrow';
Loading