Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Aug 15, 2021
1 parent 3034f92 commit 1aae248
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 62 deletions.
104 changes: 49 additions & 55 deletions components/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,8 @@ class Dropdown extends React.PureComponent {
userInputtedValue = ''

render() {
const {
innerRef,
color,
selected,
onChange,
itemWrapper,
icon,
disableInput,
title,
} = this.props
const { innerRef, color, selected, onChange, itemWrapper, icon, disableInput, title } =
this.props
const { itemsToShow, inputValue } = this.state

const labelId = title ? `${title.toLowerCase()}-dropdown` : undefined
Expand Down Expand Up @@ -98,51 +90,53 @@ class Dropdown extends React.PureComponent {
}
}

const renderDropdown = ({ color, list, itemWrapper, icon, disableInput, title, labelId }) => ({
isOpen,
highlightedIndex,
selectedItem,
getRootProps,
getToggleButtonProps,
getInputProps,
getItemProps,
}) => {
return (
<DropdownContainer {...getRootProps({ refKey: 'innerRef' })}>
{title && <VisuallyHidden id={labelId}>{title}</VisuallyHidden>}
<DropdownIcon isOpen={isOpen}>{icon}</DropdownIcon>
<SelectedItem
getToggleButtonProps={getToggleButtonProps}
getInputProps={getInputProps}
isOpen={isOpen}
color={color}
hasIcon={!!icon}
disabled={disableInput}
>
{selectedItem.name}
</SelectedItem>
{isOpen ? (
<ListItems color={color}>
{list.map((item, index) => (
<ListItem
key={index}
color={color}
item={item}
itemWrapper={itemWrapper}
{...getItemProps({
item,
isSelected: selectedItem.name === item.name,
isHighlighted: highlightedIndex === index,
})}
>
{item.name}
</ListItem>
))}
</ListItems>
) : null}
</DropdownContainer>
)
}
const renderDropdown =
({ color, list, itemWrapper, icon, disableInput, title, labelId }) =>
({
isOpen,
highlightedIndex,
selectedItem,
getRootProps,
getToggleButtonProps,
getInputProps,
getItemProps,
}) => {
return (
<DropdownContainer {...getRootProps({ refKey: 'innerRef' })}>
{title && <VisuallyHidden id={labelId}>{title}</VisuallyHidden>}
<DropdownIcon isOpen={isOpen}>{icon}</DropdownIcon>
<SelectedItem
getToggleButtonProps={getToggleButtonProps}
getInputProps={getInputProps}
isOpen={isOpen}
color={color}
hasIcon={!!icon}
disabled={disableInput}
>
{selectedItem.name}
</SelectedItem>
{isOpen ? (
<ListItems color={color}>
{list.map((item, index) => (
<ListItem
key={index}
color={color}
item={item}
itemWrapper={itemWrapper}
{...getItemProps({
item,
isSelected: selectedItem.name === item.name,
isHighlighted: highlightedIndex === index,
})}
>
{item.name}
</ListItem>
))}
</ListItems>
) : null}
</DropdownContainer>
)
}

const DropdownContainer = ({ children, innerRef, ...rest }) => {
return (
Expand Down
10 changes: 5 additions & 5 deletions components/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function userTiming({ category, status, value }) {
window.gtag('event', status, {
event_category: 'Performance',
event_label: category,
value
value,
})
} catch (err) {
// pass
Expand All @@ -20,7 +20,7 @@ export function usePerformanceMeasurement() {
userTiming({
category: 'paint',
status: entry.name,
value: entry.startTime
value: entry.startTime,
})
})
const navigationTiming = window.performance.getEntriesByType('navigation')
Expand All @@ -30,7 +30,7 @@ export function usePerformanceMeasurement() {
userTiming({
category: 'paint',
status: 'time to first byte',
value: navigationTiming.responseEnd - navigationTiming.requestStart
value: navigationTiming.responseEnd - navigationTiming.requestStart,
})
}

Expand All @@ -45,7 +45,7 @@ export function usePerformanceMeasurement() {
userTiming({
category: 'javascript',
status: 'script count',
value: javascriptFiles.length
value: javascriptFiles.length,
})

/*
Expand All @@ -55,7 +55,7 @@ export function usePerformanceMeasurement() {
userTiming({
category: 'javascript',
status: 'script size',
value: javascriptFiles.reduce((sum, script) => script.encodedBodySize + sum, 0)
value: javascriptFiles.reduce((sum, script) => script.encodedBodySize + sum, 0),
})
}
} catch (error) {
Expand Down
10 changes: 8 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ module.exports = withBundleAnalyzer(
use: [options.defaultLoaders.babel],
})
config.plugins.push(
new options.webpack.IgnorePlugin({ resourceRegExp: /\.html$/, contextRegExp: /node_modules/ })
new options.webpack.IgnorePlugin({
resourceRegExp: /\.html$/,
contextRegExp: /node_modules/,
})
)
config.plugins.push(
new options.webpack.IgnorePlugin({ resourceRegExp: /\.css$/, contextRegExp: /node_modules/ })
new options.webpack.IgnorePlugin({
resourceRegExp: /\.css$/,
contextRegExp: /node_modules/,
})
)

return config
Expand Down

0 comments on commit 1aae248

Please sign in to comment.