Skip to content

Commit d9dab97

Browse files
author
Luke Bowerman
authored
Fix PageSize fontSize, simplify DOM a smidge (#833)
1 parent 6d66d6e commit d9dab97

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

packages/components/src/PageSize/PageSize.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ test('<PageSize/> with defaults', () => {
4040
<PageSize value={10} total={1000} onChange={onChange} />
4141
)
4242

43-
getByText('Display')
4443
const select = getByDisplayValue('10')
45-
getByText('of 1000')
4644

4745
fireEvent.click(select)
4846

@@ -65,9 +63,7 @@ test('<PageSize/> with custom options prop', () => {
6563
/>
6664
)
6765

68-
getByText('Display')
6966
const select = getByDisplayValue('20')
70-
getByText('of 1000')
7167

7268
fireEvent.click(select)
7369

packages/components/src/PageSize/PageSize.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import React, { FC } from 'react'
2828
import styled from 'styled-components'
2929
import { Select } from '../Form'
30-
import { Text } from '../Text'
3130

3231
export interface PageSizeProps {
3332
className?: string
@@ -65,30 +64,27 @@ export const PageSizeLayout: FC<PageSizeProps> = ({
6564
total,
6665
className,
6766
onChange,
68-
options,
67+
options = defaultPageSizes,
6968
}) => {
70-
options = options || defaultPageSizes
71-
72-
const handleOnChange = (newValue: string) => {
73-
onChange(Number(newValue))
74-
}
69+
const handleOnChange = (newValue: string) => onChange(Number(newValue))
7570

7671
return Math.min(...options) < total ? (
7772
<div className={className}>
78-
<Text>Display</Text>
73+
Display
7974
<Select
8075
width="5rem"
81-
mx="medium"
76+
mx="xsmall"
8277
options={arrayToSelectOptions(options)}
8378
value={String(value)}
8479
onChange={handleOnChange}
8580
/>
86-
<Text>of {total}</Text>
81+
of {total}
8782
</div>
8883
) : null
8984
}
9085

9186
export const PageSize = styled(PageSizeLayout)`
92-
display: flex;
9387
align-items: center;
88+
display: flex;
89+
font-size: ${({ theme }) => theme.fontSizes.small};
9490
`

0 commit comments

Comments
 (0)