Skip to content

Commit 544b75c

Browse files
committed
Enahnce the numeric input to support append element
1 parent 135a42b commit 544b75c

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
import React, { ComponentProps } from 'react'
2-
32
import { NumericInput as RedisNumericInput } from '@redis-ui/components'
3+
import { InputAppend } from './numeric-input.styles'
44

5-
export type RedisNumericInputProps = ComponentProps<typeof RedisNumericInput>
5+
export type RedisNumericInputProps = ComponentProps<
6+
typeof RedisNumericInput
7+
> & {
8+
append?: React.ReactNode
9+
}
610

7-
export default function NumericInput(props: RedisNumericInputProps) {
8-
return <RedisNumericInput {...props} />
11+
export default function NumericInput({
12+
append,
13+
...props
14+
}: RedisNumericInputProps) {
15+
return append ? (
16+
<InputAppend>
17+
<RedisNumericInput {...props} />
18+
{append}
19+
</InputAppend>
20+
) : (
21+
<RedisNumericInput {...props} />
22+
)
923
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// styles.scss.ts
2+
import styled from 'styled-components'
3+
4+
export const InputAppend = styled.div`
5+
display: flex;
6+
align-items: center;
7+
align-content: center;
8+
gap: 130px;
9+
padding-left: 10px;
10+
padding-bottom: 3px;
11+
`

0 commit comments

Comments
 (0)