From 400881b1b18ec6b5981c3f14593db43df131c264 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 23 Oct 2020 12:44:45 -0230 Subject: [PATCH] Remove broken Storybook stories (#9690) These two stories showcased components that used React context and Redux state that was not made available in the stories themselves. They both crashed with an error when rendered in Storybook. Instead of going through a great deal of effort to setup mocks for the global Redux state and context, they have been removed. They are perhaps the wrong layer for us to showcase in Storybook. Storybook is more well suited for individual components that contain just UI logic. --- .../awaiting-swap/awaiting-swap.stories.js | 73 --------------- .../loading-swaps-quotes.stories.js | 91 ------------------- 2 files changed, 164 deletions(-) delete mode 100644 ui/app/pages/swaps/awaiting-swap/awaiting-swap.stories.js delete mode 100644 ui/app/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.stories.js diff --git a/ui/app/pages/swaps/awaiting-swap/awaiting-swap.stories.js b/ui/app/pages/swaps/awaiting-swap/awaiting-swap.stories.js deleted file mode 100644 index 98d348d41..000000000 --- a/ui/app/pages/swaps/awaiting-swap/awaiting-swap.stories.js +++ /dev/null @@ -1,73 +0,0 @@ -import React from 'react' -import { number, text, select } from '@storybook/addon-knobs/react' -import { - QUOTES_EXPIRED_ERROR, - SWAP_FAILED_ERROR, - ERROR_FETCHING_QUOTES, - QUOTES_NOT_AVAILABLE_ERROR, -} from '../../../helpers/constants/swaps' -import AwaitingSwap from './awaiting-swap' - -export default { - title: 'AwaitingSwap', -} - -export const swapNotComplete = () => ( -
- -
-) - -export const swapComplete = () => ( -
- -
-) - -export const swapError = () => ( -
- -
-) diff --git a/ui/app/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.stories.js b/ui/app/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.stories.js deleted file mode 100644 index ac39d1850..000000000 --- a/ui/app/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.stories.js +++ /dev/null @@ -1,91 +0,0 @@ -import React, { useState, useEffect } from 'react' -import { storiesMetadata } from './loading-swaps-quotes-stories-metadata' -import LoadingSwapsQuotes from './loading-swaps-quotes' - -export default { - title: 'LoadingSwapsQuotes', -} - -export const FasterThanExpectedCompletion = () => { - const [loading, setLoading] = useState(false) - const [loadingComplete, setLoadingComplete] = useState(false) - const [done, setDone] = useState(false) - - useEffect(() => { - if (!done && !loading) { - setLoading(true) - setTimeout(() => { - setLoading(false) - setLoadingComplete(true) - }, 3000) - } - }, [done, loading]) - - return ( -
-
- setDone(true)} - aggregatorMetadata={storiesMetadata} - /> -
-
- ) -} - -export const SlowerThanExpectedCompletion = () => { - const [loading, setLoading] = useState(false) - const [loadingComplete, setLoadingComplete] = useState(false) - const [done, setDone] = useState(false) - - useEffect(() => { - if (!done && !loading) { - setLoading(true) - setTimeout(() => { - setLoading(false) - setLoadingComplete(true) - }, 10000) - } - }, [done, loading]) - - return ( -
-
- setDone(true)} - aggregatorMetadata={storiesMetadata} - /> -
-
- ) -} - -export const FasterThanExpectedCompletionWithError = () => { - const [loading, setLoading] = useState(false) - const [loadingComplete, setLoadingComplete] = useState(false) - const [done, setDone] = useState(false) - - useEffect(() => { - if (!done && !loading) { - setLoading(true) - setTimeout(() => { - setLoading(false) - setLoadingComplete(true) - }, 3000) - } - }, [done, loading]) - - return ( -
-
- setDone(true)} - aggregatorMetadata={storiesMetadata} - /> -
-
- ) -}