-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Lazy document to handle viewing PDF's without downloading. #253
Changes from 6 commits
b3ecb5e
234f4fd
a941b3b
166e41e
6bc5f10
ac0bd9f
d819993
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"typescript.validate.enable": false, | ||
"javascript.validate.enable": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@import 'rc-slider/assets/index.css'; | ||
|
||
.facet-slider > .ui.grid { | ||
margin-top: 0em; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import React, { | |
import { Grid } from 'semantic-ui-react'; | ||
import Facet, { type Props as FacetProps } from './Facet'; | ||
import { type RangeSliderProps } from '../types/InstantSearch'; | ||
import 'rc-slider/assets/index.css'; | ||
|
||
import './FacetSlider.css'; | ||
|
||
type Props = FacetProps & RangeSliderProps; | ||
|
@@ -25,7 +25,7 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl | |
refine, | ||
} = useRangeSlider(props); | ||
|
||
const [valueView, setValueView] = useState<Array<number>>([range.min, range.max]); | ||
const [valueView, setValueView] = useState < Array < number >> ([range.min, range.max]); | ||
|
||
/** | ||
* Sets the visibility variable based on the range min and max. | ||
|
@@ -72,12 +72,12 @@ const FacetSlider = forwardRef(({ useRangeSlider, ...props }: Props, ref: HTMLEl | |
columns={2} | ||
> | ||
<Grid.Column> | ||
{ valueView[0] } | ||
{valueView[0]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a style guide I can use in VSCode? This I believe is the default ruleset of the VSCode formatter it is using as I do not have prettier activated right now...Though I think we should use it ;-) |
||
</Grid.Column> | ||
<Grid.Column | ||
textAlign='right' | ||
> | ||
{ valueView[1] } | ||
{valueView[1]} | ||
</Grid.Column> | ||
</Grid> | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// @flow | ||
|
||
import React, { useMemo } from 'react'; | ||
import { Icon, Button } from 'semantic-ui-react'; | ||
import i18n from '../i18n/i18n'; | ||
|
||
type Props = { | ||
basic?: boolean, | ||
className?: string, | ||
color?: string, | ||
compact?: boolean, | ||
primary?: boolean, | ||
size?: string, | ||
secondary?: boolean, | ||
url: string, | ||
}; | ||
|
||
const ViewPDFButton = (props: Props) => { | ||
/** | ||
* Sets the appropriate class names based on the formatting props. | ||
* | ||
* @type {string} | ||
*/ | ||
const className = useMemo(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of these props can be passed to the Button component as props, instead of concatenting them as a class name. I'm wondering if this needs to be it's own component or can be done inline in the LazyDocument:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a copy/paste of the DownloadButton component as a starting point. I switched from using an anchor to see if I could resolve an earlier issue. I use this button outside of LazyDocument in the ArchNet client so I think it makes sense to keep it as a functional component, but I could definitely refactor the classname stuff. Do not know if it is a priority right now. |
||
const classNames = ['ui', 'button']; | ||
|
||
if (props.basic) { | ||
classNames.push('basic'); | ||
} | ||
|
||
if (props.className) { | ||
classNames.push(...props.className.split(' ')); | ||
} | ||
|
||
if (props.color) { | ||
classNames.push(props.color); | ||
} | ||
|
||
if (props.compact) { | ||
classNames.push('compact'); | ||
} | ||
|
||
if (props.primary) { | ||
classNames.push('primary'); | ||
} | ||
|
||
if (props.secondary) { | ||
classNames.push('secondary'); | ||
} | ||
|
||
if (props.size) { | ||
classNames.push(props.size); | ||
} | ||
|
||
return classNames.join(' '); | ||
}, [props.basic, props.color]); | ||
|
||
return ( | ||
<Button className={className} onClick={() => window.open(props.url, '_blank')}> | ||
<Icon | ||
name='file pdf' | ||
/> | ||
{i18n.t('Common.buttons.pdf')} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default ViewPDFButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,5 @@ | |
"packages/user-defined-fields", | ||
"packages/visualize" | ||
], | ||
"version": "1.1.3" | ||
} | ||
"version": "1.1.4-beta.12" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we preserve the current spacing rules? I'm not sure if this is a Prettier/ESLint issue, or something else.