-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(PhoneInput): add tkv3 phone input
Completes #111
- Loading branch information
1 parent
89685b1
commit 25ab57a
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Story, Meta } from '@storybook/react'; | ||
|
||
import { classlessSelector, classySelector, PhoneInput } from './PhoneInput'; | ||
|
||
const contentVariants = [ | ||
{}, | ||
{ 'data-disabled': true }, | ||
{ 'data-stretch': true }, | ||
{ 'data-error': true } | ||
]; | ||
|
||
export default { | ||
title: 'TableKit/PhoneInput', | ||
component: PhoneInput, | ||
parameters: { | ||
variants: contentVariants, | ||
classlessSelector, | ||
classySelector | ||
} | ||
} as Meta; | ||
|
||
export const Variants: Story = () => ( | ||
<> | ||
{contentVariants.map((props) => ( | ||
<PhoneInput {...props} /> | ||
))} | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Close } from '@carbon/icons-react'; | ||
import { css } from '@emotion/react'; | ||
import * as React from 'react'; | ||
|
||
import { Input, InputWithIcons } from './Input'; | ||
|
||
export const classlessSelector = 'input[type="tel"]'; | ||
export const classySelector = '.phone-input'; | ||
|
||
export const baseStyles = css``; | ||
|
||
export interface Props { | ||
// phone specific props | ||
} | ||
|
||
export const PhoneInput = React.forwardRef< | ||
HTMLDivElement, | ||
Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & Props | ||
>((props, ref) => ( | ||
<InputWithIcons {...props} ref={ref}> | ||
<Input placeholder="09000789" type="tel" /> | ||
<Close size={16} /> | ||
</InputWithIcons> | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters