diff --git a/packages/lib-classifier/src/components/Classifier/components/FieldGuide/FieldGuideContainer.js b/packages/lib-classifier/src/components/Classifier/components/FieldGuide/FieldGuideContainer.js index 2d3665861f7..9ce0061c773 100644 --- a/packages/lib-classifier/src/components/Classifier/components/FieldGuide/FieldGuideContainer.js +++ b/packages/lib-classifier/src/components/Classifier/components/FieldGuide/FieldGuideContainer.js @@ -36,6 +36,7 @@ class FieldGuideContainer extends React.Component { diff --git a/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/FieldGuide.js b/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/FieldGuide.js index 73e932f42d7..b14dd6d99d3 100644 --- a/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/FieldGuide.js +++ b/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/FieldGuide.js @@ -1,22 +1,15 @@ import { Box } from 'grommet' import React from 'react' import PropTypes from 'prop-types' -import styled from 'styled-components' +import { ResponsiveContext } from 'grommet' import { inject, observer } from 'mobx-react' import FieldGuideItems from './components/FieldGuideItems' import FieldGuideItem from './components/FieldGuideItem' -const StyledBox = styled(Box)` - max-height: 415px; - max-width: 490px; - overflow: auto; -` - - function storeMapper(stores) { - const { active: fieldGuide, activeItem } = stores.classifierStore.fieldGuide + const { active: fieldGuide, activeItemIndex } = stores.classifierStore.fieldGuide return { - activeItem, + activeItemIndex, items: fieldGuide.items } } @@ -25,24 +18,30 @@ function storeMapper(stores) { @observer class FieldGuide extends React.Component { render () { - const { activeItem, className, items } = this.props + const { activeItemIndex, className, items } = this.props return ( - - {items[activeItem] ? - : - } - + + {size => { + const height = (size === 'small') ? '100%' : '415px' + const width = (size === 'small') ? '100%' : '490px' + return ( + + {items[activeItemIndex] ? + : + } + )}} + ) } } FieldGuide.wrappedComponent.defaultProps = { - activeItem: -1, + activeItemIndex: -1, className: '', } FieldGuide.wrappedComponent.propTypes = { - activeItem: PropTypes.number, + activeItemIndex: PropTypes.number, className: PropTypes.string, items: PropTypes.arrayOf(PropTypes.object).isRequired } diff --git a/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/components/FieldGuideItem/FieldGuideItem.js b/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/components/FieldGuideItem/FieldGuideItem.js index a6b36657acc..8fec272f055 100644 --- a/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/components/FieldGuideItem/FieldGuideItem.js +++ b/packages/lib-classifier/src/components/Classifier/components/FieldGuide/components/FieldGuide/components/FieldGuideItem/FieldGuideItem.js @@ -2,15 +2,26 @@ import { Button, Box } from 'grommet' import { FormPrevious } from 'grommet-icons' import styled from 'styled-components' import React from 'react' -import { Markdownz, Media } from '@zooniverse/react-components' +import { Markdownz } from '@zooniverse/react-components' +import zooTheme from '@zooniverse/grommet-theme' import PropTypes from 'prop-types' import { observable } from 'mobx' import { inject, observer, PropTypes as MobXPropTypes } from 'mobx-react' +import FieldGuideItemIcon from '../FieldGuideItemIcon' import counterpart from 'counterpart' import en from './locales/en' counterpart.registerTranslations('en', en) +const StyledButton = styled(Button)` + padding: 0; + + &:hover > svg, &:focus > svg { + fill: ${zooTheme.global.colors['dark-5']}; + stroke: ${zooTheme.global.colors['dark-5']}; + } +` + const FieldGuideItemHeader = styled(Box)` > h3 { margin: 0; @@ -18,10 +29,10 @@ const FieldGuideItemHeader = styled(Box)` ` function storeMapper(stores) { - const { setActiveItem, attachedMedia: icons } = stores.classifierStore.fieldGuide + const { setActiveItemIndex, attachedMedia: icons } = stores.classifierStore.fieldGuide return { icons, - setActiveItem + setActiveItemIndex } } @@ -29,16 +40,17 @@ function storeMapper(stores) { @observer class FieldGuideItem extends React.Component { render () { - const { className, icons, item, setActiveItem } = this.props + const { className, icons, item, setActiveItemIndex } = this.props const icon = icons.get(item.icon) return ( - -