From 7db7c5c6486c4276c84a1791f40fb926ccd6d1ae Mon Sep 17 00:00:00 2001 From: Kevin Dwan <25626770+krdwan@users.noreply.github.com> Date: Tue, 15 Sep 2020 11:15:09 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=96=20=20[bento][amp-date-countdown]?= =?UTF-8?q?=20Preact=20storybook=20for=20amp-date-countdown=20(#30227)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Rough draft preact storybook for date-countdown * Remove unneeded knobs --- .../amp-date-countdown/1.0/storybook/Basic.js | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 extensions/amp-date-countdown/1.0/storybook/Basic.js diff --git a/extensions/amp-date-countdown/1.0/storybook/Basic.js b/extensions/amp-date-countdown/1.0/storybook/Basic.js new file mode 100644 index 000000000000..2b8f24725dd8 --- /dev/null +++ b/extensions/amp-date-countdown/1.0/storybook/Basic.js @@ -0,0 +1,99 @@ +/** + * Copyright 2020 The AMP HTML Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as Preact from '../../../../src/preact'; +import {DateCountdown} from '../date-countdown'; +import {date, number, select, withKnobs} from '@storybook/addon-knobs'; +import {withA11y} from '@storybook/addon-a11y'; + +export default { + title: 'DateCountdown', + component: DateCountdown, + decorators: [withA11y, withKnobs], +}; + +export const _default = () => { + const localeConfigurations = [ + 'google', + 'de', + 'en', + 'es', + 'fr', + 'id', + 'it', + 'ja', + 'ko', + 'nl', + 'pt', + 'ru', + 'th', + 'tr', + 'vi', + 'zh-cn', + 'zh-tw', + ]; + + const whenEndedConfigurations = ['stop', 'continue']; + + const biggestUnitConfigurations = [ + undefined, + 'DAYS', + 'HOURS', + 'MINUTES', + 'SECONDS', + ]; + + const endDate = date('endDate', new Date()); + const offsetSeconds = number('offsetSeconds', null); + const locale = select( + 'locale', + localeConfigurations, + localeConfigurations[0] + ); + const whenEnded = select( + 'whenEnded', + whenEndedConfigurations, + whenEndedConfigurations[0] + ); + const biggestUnit = select( + 'biggestUnit', + biggestUnitConfigurations, + biggestUnitConfigurations[0] + ); + + return ( +
+ ( +
+ {`Days ${data.days} ${data.dd} ${data.d}`} +
+ {`Hours ${data.hours} ${data.hh} ${data.h}`} +
+ {`Minutes ${data.minutes} ${data.mm} ${data.m}`} +
+ {`Seconds ${data.seconds} ${data.ss} ${data.s}`} +
+ )} + >
+
+ ); +};