From 835e30bff4b8cac5cef11e3b478e1e2be6f1671b Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 15 Mar 2018 10:48:04 -0700 Subject: [PATCH] moved default thumbnail from assetpreview to state --- react/components/AssetPreview/index.js | 10 ++++++++++ react/components/AssetPreview/{index.jsx => view.jsx} | 3 +-- react/reducers/site.js | 7 +++++-- 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 react/components/AssetPreview/index.js rename react/components/AssetPreview/{index.jsx => view.jsx} (84%) diff --git a/react/components/AssetPreview/index.js b/react/components/AssetPreview/index.js new file mode 100644 index 00000000..e431b9bd --- /dev/null +++ b/react/components/AssetPreview/index.js @@ -0,0 +1,10 @@ +import { connect } from 'react-redux'; +import View from './view'; + +const mapStateToProps = ({site: {defaults: { defaultThumbnail }}}) => { + return { + defaultThumbnail, + }; +}; + +export default connect(mapStateToProps, null)(View); diff --git a/react/components/AssetPreview/index.jsx b/react/components/AssetPreview/view.jsx similarity index 84% rename from react/components/AssetPreview/index.jsx rename to react/components/AssetPreview/view.jsx index aad8ab2d..d98a1f4c 100644 --- a/react/components/AssetPreview/index.jsx +++ b/react/components/AssetPreview/view.jsx @@ -1,8 +1,7 @@ import React from 'react'; import { Link } from 'react-router-dom'; -const { assetDefaults: { thumbnail: defaultThumbnail } } = require('../../../config/siteConfig.js'); -const AssetPreview = ({ claimData: { name, claimId, fileExt, contentType, thumbnail } }) => { +const AssetPreview = ({ defaultThumbnail, claimData: { name, claimId, fileExt, contentType, thumbnail } }) => { const directSourceLink = `${claimId}/${name}.${fileExt}`; const showUrlLink = `/${claimId}/${name}`; return ( diff --git a/react/reducers/site.js b/react/reducers/site.js index 7284e6b6..91524abf 100644 --- a/react/reducers/site.js +++ b/react/reducers/site.js @@ -1,7 +1,10 @@ -const { details: { host } } = require('../../config/siteConfig.js'); +const { details: { host }, assetDefaults: { thumbnail: defaultThumbnail } } = require('../../config/siteConfig.js'); const initialState = { - host: host, + host, + defaults: { + defaultThumbnail, + }, }; export default function (state = initialState, action) {