Skip to content
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

feat(TextInput): Update TextInput to use data attributes for styling #5242

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/real-fans-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Convert TextInput to use data attributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Token from '../Token/Token'
import type {TokenSizeKeys} from '../Token/TokenBase'

import type {TextInputSizes} from '../internal/components/TextInputWrapper'
import TextInputWrapper, {textInputHorizPadding} from '../internal/components/TextInputWrapper'
import TextInputWrapper from '../internal/components/TextInputWrapper'
import UnstyledTextInput from '../internal/components/UnstyledTextInput'
import TextInputInnerVisualSlot from '../internal/components/TextInputInnerVisualSlot'

Expand Down Expand Up @@ -266,8 +266,8 @@ function TextInputWithTokensInnerComponent<TokenComponentType extends AnyReactCo
variant={variantProp} // deprecated. use `size` prop instead
onClick={focusInput}
sx={{
paddingLeft: textInputHorizPadding,
py: `calc(${textInputHorizPadding} / 2)`,
paddingLeft: '12px',
py: `calc(12px / 2)`,
...(block
? {
display: 'flex',
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/__tests__/Textarea.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ describe('Textarea', () => {
width: '100%',
display: 'flex',
}
const defaultStyles = renderStyles(<Textarea block />)
const blockStyles = renderStyles(<Textarea />)
const defaultStyles = renderStyles(<Textarea />)
const blockStyles = renderStyles(<Textarea block />)

expect(defaultStyles).toEqual(expect.objectContaining(expectedStyles))
expect(blockStyles).not.toEqual(expect.objectContaining(expectedStyles))
expect(defaultStyles).not.toEqual(expect.objectContaining(expectedStyles))
expect(blockStyles).toEqual(expect.objectContaining(expectedStyles))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update so that variables accurately reflect what is being tests.

})

it('renders default resize values correctly', () => {
Expand Down
Loading
Loading