Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit f5bff8b

Browse files
committed
feat!: consistent type names, remove I prefix
Consistently name component pros as *Props. A prop type for the Input component should now be named InputProps consistently. Before they could be either IInput, IInputProps or InputProps.
1 parent 0e42811 commit f5bff8b

File tree

126 files changed

+696
-703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+696
-703
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ with the following contents:
4949

5050
```typescript
5151
import 'styled-components'
52-
import { ITheme } from './theme'
52+
import { Theme } from './theme'
5353

5454
declare module 'styled-components' {
55-
export interface DefaultTheme extends ITheme {}
55+
export interface DefaultTheme extends Theme {}
5656
}
5757
```
5858

packages/core/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ with the following contents:
4141

4242
```typescript
4343
import 'styled-components'
44-
import { ITheme } from './theme'
44+
import { Theme } from './theme'
4545

4646
declare module 'styled-components' {
47-
export interface DefaultTheme extends ITheme {}
47+
export interface DefaultTheme extends Theme {}
4848
}
4949
```
5050

packages/core/src/Button/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ type ButtonType = 'button' | 'submit' | 'reset'
204204
export type ButtonVariantType = 'primary' | 'secondary'
205205
export type ButtonClickHandler = React.MouseEventHandler<BaseElement>
206206

207-
interface IBaseButtonProps extends BaseProps {
207+
interface BaseButtonProps extends BaseProps {
208208
/**
209209
* Specifies the name for a <button> element.
210210
*/
@@ -230,7 +230,7 @@ interface IBaseButtonProps extends BaseProps {
230230
readonly accent?: boolean
231231
}
232232

233-
export interface IButtonProps extends IBaseButtonProps {
233+
export interface ButtonProps extends BaseButtonProps {
234234
/**
235235
* String used to label the button.
236236
*/
@@ -242,7 +242,7 @@ export interface IButtonProps extends IBaseButtonProps {
242242
}
243243

244244
/* eslint-disable-next-line react/display-name */
245-
export const Button = React.forwardRef<BaseElement, IButtonProps>(
245+
export const Button = React.forwardRef<BaseElement, ButtonProps>(
246246
(
247247
{
248248
disabled = false,
@@ -422,15 +422,15 @@ const IconButtonHalo = styled.div<{ readonly accent: boolean }>`
422422
transition: transform 100ms;
423423
`
424424

425-
export interface IIconButtonProps extends IBaseButtonProps {
425+
export interface IconButtonProps extends BaseButtonProps {
426426
/**
427427
* Icon that shows inside Button.
428428
*/
429429
readonly icon: IconType
430430
}
431431

432432
/* eslint-disable-next-line react/display-name */
433-
export const IconButton = React.forwardRef<BaseElement, IIconButtonProps>(
433+
export const IconButton = React.forwardRef<BaseElement, IconButtonProps>(
434434
(
435435
{
436436
disabled,

packages/core/src/Card/CardTabs.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const TabBaseMarker = styled.div<{
111111
`}
112112
`
113113

114-
interface ITabProps {
114+
interface TabProps {
115115
readonly id: number
116116
readonly selected?: boolean
117117
readonly label: string
@@ -129,7 +129,7 @@ function InternalTab({
129129
variant,
130130
disabled = false,
131131
hasBackground = false,
132-
}: ITabProps): JSX.Element {
132+
}: TabProps): JSX.Element {
133133
const onClickHandler = useCallback<OnClickHandler>(() => {
134134
if (!selected) {
135135
onClick(id)
@@ -154,21 +154,21 @@ function InternalTab({
154154
)
155155
}
156156

157-
interface ITab<T> {
157+
interface TabItem<T> {
158158
readonly value: T
159159
readonly label: string
160160
readonly disabled?: boolean
161161
}
162162

163-
interface ICardTabsProps<T> extends Omit<BaseProps, 'onChange'> {
163+
interface CardTabsProps<T> extends Omit<BaseProps, 'onChange'> {
164164
/**
165165
* Current selected tab, matching a `value` from options
166166
*/
167167
readonly value: T
168168
/**
169169
* Array with object that contain `value`, `label`, and optional `disabled`
170170
*/
171-
readonly options: ReadonlyArray<ITab<T>>
171+
readonly options: ReadonlyArray<TabItem<T>>
172172
/**
173173
* Tab change callback, called with the `value` from the selected options
174174
*/
@@ -190,7 +190,7 @@ export function CardTabs<T>({
190190
variant,
191191
hasBackground,
192192
...props
193-
}: ICardTabsProps<T>): JSX.Element {
193+
}: CardTabsProps<T>): JSX.Element {
194194
const onClickHandler = useCallback(index => onChange(options[index].value), [
195195
options,
196196
onChange,

packages/core/src/Card/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const CardContent = styled(CardPlainContent)`
7373

7474
export type CardWidthType = 'small' | 'medium' | 'full'
7575

76-
export interface ICardProps extends BaseProps {
76+
export interface CardProps extends BaseProps {
7777
/**
7878
* `class` to be passed to the component.
7979
*/
@@ -92,7 +92,7 @@ export interface ICardProps extends BaseProps {
9292
readonly square?: boolean
9393
}
9494

95-
export const Card: React.FC<ICardProps> = ({
95+
export const Card: React.FC<CardProps> = ({
9696
width = 'full',
9797
square = true,
9898
children,
@@ -103,7 +103,7 @@ export const Card: React.FC<ICardProps> = ({
103103
</CardContainer>
104104
)
105105

106-
export const PanelCard: React.FC<ICardProps> = ({
106+
export const PanelCard: React.FC<CardProps> = ({
107107
width = 'full',
108108
square = true,
109109
children,

packages/core/src/Checkbox/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ type BaseProps = React.InputHTMLAttributes<BaseElement>
161161
export type CheckboxChangeHandler = React.ChangeEventHandler<BaseElement>
162162
export type CheckboxValueChangeHandler = (value: boolean) => void
163163

164-
export interface ICheckboxProps extends BaseProps {
164+
export interface CheckboxProps extends BaseProps {
165165
/**
166166
* Specifies the name of an input element.
167167
*/
@@ -198,7 +198,7 @@ export interface ICheckboxProps extends BaseProps {
198198
readonly onPartialValueChange?: CheckboxValueChangeHandler
199199
}
200200

201-
export const Checkbox: React.FunctionComponent<ICheckboxProps> = ({
201+
export const Checkbox: React.FunctionComponent<CheckboxProps> = ({
202202
checked,
203203
label,
204204
disabled = false,
@@ -305,4 +305,4 @@ export const Checkbox: React.FunctionComponent<ICheckboxProps> = ({
305305
)
306306
}
307307

308-
export const CheckboxField = withField<ICheckboxProps>(Checkbox)
308+
export const CheckboxField = withField<CheckboxProps>(Checkbox)

packages/core/src/Chip/BaseChip.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const ChipErrorIcon = styled(Icon).attrs({ icon: ErrorWithoutCircleIcon })`
5959
color: ${({ theme }) => theme.color.elementError()};
6060
`
6161

62-
export interface IBaseChipProps extends BaseProps {
62+
export interface BaseChipProps extends BaseProps {
6363
/**
6464
* `class` to be passed to the component.
6565
*/
@@ -79,7 +79,7 @@ export interface IBaseChipProps extends BaseProps {
7979
}
8080

8181
/* eslint-disable-next-line react/display-name */
82-
export const BaseChip = React.forwardRef<HTMLDivElement, IBaseChipProps>(
82+
export const BaseChip = React.forwardRef<HTMLDivElement, BaseChipProps>(
8383
({ error = false, disabled = false, component, ...props }, ref) => (
8484
<ChipArea ref={ref} error={error} disabled={disabled} {...props}>
8585
{error ? <ChipErrorIcon /> : null}

packages/core/src/Chip/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { CloseIcon } from 'practical-react-components-icons'
88
import { spacing, componentSize } from '../designparams'
99
import { ClickableIcon, Icon, IconType } from '../Icon'
1010
import { Typography } from '../Typography'
11-
import { BaseChip, IBaseChipProps } from './BaseChip'
11+
import { BaseChip, BaseChipProps } from './BaseChip'
1212

1313
const ChipIcon = styled(Icon)`
1414
width: ${componentSize.mini};
@@ -25,7 +25,7 @@ const ChipRemoveIcon = styled(ClickableIcon).attrs({
2525
margin-left: ${spacing.small};
2626
`
2727

28-
interface IChipProps extends Omit<IBaseChipProps, 'component' | 'noPadding'> {
28+
interface ChipProps extends Omit<BaseChipProps, 'component' | 'noPadding'> {
2929
/**
3030
* Changes the text of the label displayed on the chip.
3131
*/
@@ -42,7 +42,7 @@ interface IChipProps extends Omit<IBaseChipProps, 'component' | 'noPadding'> {
4242
}
4343

4444
/* eslint-disable-next-line react/display-name */
45-
export const Chip = React.forwardRef<HTMLDivElement, IChipProps>(
45+
export const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
4646
({ text, error = false, onRemove, icon, ...props }, ref) => {
4747
const component = useMemo(() => {
4848
return (

packages/core/src/Content/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ const Caption = styled(Typography)`
4747
color: ${({ theme }) => theme.color.text03()};
4848
`
4949

50-
interface ITextBlockProps extends BaseProps {
50+
interface TextBlockProps extends BaseProps {
5151
/**
5252
* `class` to be passed to the component.
5353
*/
5454
readonly className?: BaseProps['className']
5555
readonly text: string
5656
readonly caption?: string
5757
}
58-
export const TextBlock: React.FC<ITextBlockProps> = ({
58+
export const TextBlock: React.FC<TextBlockProps> = ({
5959
text,
6060
caption,
6161
...props
@@ -131,15 +131,15 @@ const GroupTitle: React.FC<{
131131
)
132132
}
133133

134-
interface IFormSectionProps extends BaseProps {
134+
interface FormSectionProps extends BaseProps {
135135
/**
136136
* `class` to be passed to the component.
137137
*/
138138
readonly className?: BaseProps['className']
139139
readonly title?: string
140140
}
141141

142-
export const FormSection: React.FC<IFormSectionProps> = ({
142+
export const FormSection: React.FC<FormSectionProps> = ({
143143
title,
144144
children,
145145
...props
@@ -183,7 +183,7 @@ export const ContentListItem = styled.div<{
183183
}
184184
`
185185

186-
interface IContentListItemWithHoverProps extends BaseProps {
186+
interface ContentListItemWithHoverProps extends BaseProps {
187187
/**
188188
* `class` to be passed to the component.
189189
*/
@@ -192,7 +192,7 @@ interface IContentListItemWithHoverProps extends BaseProps {
192192
readonly onHover: (hover: boolean) => void
193193
}
194194

195-
export const ContentListItemWithHover: React.FC<IContentListItemWithHoverProps> = ({
195+
export const ContentListItemWithHover: React.FC<ContentListItemWithHoverProps> = ({
196196
listHeight = 'medium',
197197
onHover,
198198
children,

packages/core/src/DateTimePicker/DatePicker.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ const DateButton = styled(NativeButton)`
7474
}
7575
`
7676

77-
interface IDateButtonLabel {
77+
interface DateButtonLabelProps {
7878
readonly selected: boolean
7979
}
8080

81-
const DateButtonLabel = styled(Typography)<IDateButtonLabel>`
81+
const DateButtonLabel = styled(Typography)<DateButtonLabelProps>`
8282
${({ theme, selected }) => {
8383
if (selected) {
8484
return css`
@@ -122,7 +122,7 @@ const getWeekDays = (lang: string) => {
122122
return days
123123
}
124124

125-
interface IDatePickerProps {
125+
interface DatePickerProps {
126126
/**
127127
* Current date value
128128
*/
@@ -145,7 +145,7 @@ interface IDatePickerProps {
145145
* Modal component that allows users to choose
146146
* date, time and time zone setting
147147
*/
148-
export const DatePicker: React.FC<IDatePickerProps> = ({
148+
export const DatePicker: React.FC<DatePickerProps> = ({
149149
date,
150150
onChange,
151151
lang = 'en',

0 commit comments

Comments
 (0)