-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sabina Talipova
committed
May 28, 2023
1 parent
f31d851
commit abdd503
Showing
3 changed files
with
2,336 additions
and
1,827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import LoginSession from 'components/#Session/#Session'; | ||
import { withKnobs, boolean } from '@storybook/addon-knobs/react'; | ||
|
||
const createDateMinutesAgo = (m) => { | ||
const d1 = new Date(); | ||
const d2 = new Date(d1); | ||
d2.setMinutes(d1.getMinutes() - m); | ||
return d2.toISOString().replace(/[TZ]/g, ' ').replace(/\.[0-9]+ $/, ''); | ||
const d1 = new Date(); | ||
const d2 = new Date(d1); | ||
d2.setMinutes(d1.getMinutes() - m); | ||
return d2 | ||
.toISOString() | ||
.replace(/[TZ]/g, ' ') | ||
.replace(/\.[0-9]+ $/, ''); | ||
}; | ||
|
||
const props = { | ||
IPAddress: '127.0.0.1', | ||
UserAgent: 'Chrome on Mac OS X 10.15.7', | ||
Created: createDateMinutesAgo(120), | ||
LastAccessed: createDateMinutesAgo(25), | ||
logout: () => 1 | ||
IPAddress: '127.0.0.1', | ||
UserAgent: 'Chrome on Mac OS X 10.15.7', | ||
Created: createDateMinutesAgo(120), | ||
LastAccessed: createDateMinutesAgo(25), | ||
logout: () => 1, | ||
}; | ||
|
||
storiesOf('SessionManager/#Session', module) | ||
.addDecorator(withKnobs) | ||
.add('Login session', () => ( | ||
<LoginSession | ||
{...props} | ||
IsCurrent={boolean('IsCurrent', false)} | ||
submitting={boolean('Submitting', false)} | ||
complete={boolean('Complete', false)} | ||
failed={boolean('Failed', false)} | ||
/> | ||
)); | ||
export default { | ||
title: 'SessionManager/#Session', | ||
component: LoginSession | ||
}; | ||
|
||
export const _LoginSession = { | ||
name: 'Login session', | ||
args: { | ||
...props, | ||
IsCurrent: false, | ||
submitting: false, | ||
complete: false, | ||
failed: false, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.