Skip to content

Commit 54a61a4

Browse files
author
Luke Bowerman
authored
Add JSDoc annoatation to ll props that should be i18n'd (#1914)
Also found a minor issue with `Badge`'s default value
1 parent 04c7938 commit 54a61a4

File tree

20 files changed

+54
-26
lines changed

20 files changed

+54
-26
lines changed

config/i18nIgnoredProps.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
*/
2626

2727
const ours = [
28+
'align',
2829
'icon',
2930
'iconBefore',
3031
'iconAfter',

packages/components/src/Badge/Badge.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ type BadgeIntent =
5353
export interface BadgeProps
5454
extends SpaceProps,
5555
CompatibleHTMLProps<HTMLSpanElement> {
56+
/**
57+
* I18n recommended: content that is user visible should be treated for i18n
58+
*/
5659
children: ReactNode
5760
/**
58-
* @default `default`
61+
* @default key
5962
**/
6063
intent?: BadgeIntent
6164

packages/components/src/Chip/Chip.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@
2626

2727
import { useTranslation } from 'react-i18next'
2828
import { reset } from '@looker/design-tokens'
29-
import React, {
30-
forwardRef,
31-
KeyboardEvent,
32-
MouseEvent,
33-
ReactNode,
34-
Ref,
35-
} from 'react'
29+
import React, { forwardRef, KeyboardEvent, MouseEvent, Ref } from 'react'
3630
import styled from 'styled-components'
3731
import {
3832
useClickable,
@@ -47,7 +41,9 @@ import { TruncateProps, truncate } from '../Text/truncate'
4741
export interface ChipProps
4842
extends GenericClickProps<HTMLSpanElement>,
4943
TruncateProps {
50-
children: ReactNode
44+
/**
45+
* I18n recommended: content that is user visible should be treated for i18n
46+
*/
5147
prefix?: string
5248
onDelete?: (
5349
e?: MouseEvent<HTMLSpanElement> | KeyboardEvent<HTMLSpanElement>

packages/components/src/CopyToClipboard/CopyToClipboard.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,22 @@ import React, { useRef, useState, FC, cloneElement } from 'react'
2828
import { ButtonOutline } from '../Button/ButtonOutline'
2929

3030
/**
31-
* This component allows user to copy contents from the, passed in ref, to the clipboard.
3231
*/
33-
3432
export interface CopyToClipboardProps {
3533
/**
3634
* Content to be copied into the clipboard
35+
* I18n recommended: content that is user visible should be treated for i18n
3736
*/
3837
content: string
3938
/**
4039
* button's label | a JSX element to replace the button
40+
* I18n recommended: content that is user visible should be treated for i18n
4141
* @default 'Copy to Clipboard'
4242
*/
4343
children?: string | JSX.Element
4444
/**
4545
* button's successfully copied label | a JSX element to replace the button
46+
* I18n recommended: content that is user visible should be treated for i18n
4647
* @default 'Copied'
4748
*/
4849
success?: string | JSX.Element

packages/components/src/DataTable/Column/DataTableCell.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ import { FocusableCell } from './FocusableCell'
4646

4747
export interface DataTableCellProps
4848
extends CompatibleHTMLProps<HTMLTableDataCellElement> {
49+
/**
50+
* I18n recommended: content that is user visible should be treated for i18n
51+
*/
4952
description?: ReactNode
5053
focusVisible?: boolean
5154
indicator?: ReactNode

packages/components/src/DataTable/Item/DataTableAction.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ import React, { ReactNode } from 'react'
3030
import { MenuItem } from '../../Menu'
3131

3232
export interface DataTableActionProps extends CompatibleHTMLProps<HTMLElement> {
33-
children?: ReactNode
33+
/**
34+
* I18n recommended: content that is user visible should be treated for i18n
35+
*/
3436
detail?: ReactNode
3537
icon?: IconNames
3638
/**

packages/components/src/DataTable/Item/DataTableItem.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface DataTableItemProps
4343
/**
4444
* Sets the tooltip text and a hidden text label for the actions button (accessible to assistive technology)
4545
* If unprovided by the user, a default string will be used instead
46+
* I18n recommended: content that is user visible should be treated for i18n
4647
* @default 'Options'
4748
*/
4849
actionsTooltip?: string
@@ -54,7 +55,9 @@ export interface DataTableItemProps
5455
* A boolean indicating whether this item is selectable or not (the item will appear greyed out if true)
5556
*/
5657
disabled?: boolean
57-
58+
/**
59+
* I18n recommended: content that is user visible should be treated for i18n
60+
*/
5861
children: JSX.Element | JSX.Element[]
5962
/*
6063
* A ReactNode (IconButton) that will be placed as a primary action on the right side of the row

packages/components/src/DataTable/Item/DataTableRow.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ import {
4646
export interface DataTableRowProps
4747
extends DataTableCheckboxProps,
4848
Omit<CompatibleHTMLProps<HTMLElement>, 'onChange' | 'checked'> {
49+
/**
50+
* Content displayed after selection checkbox (optional) and row cells.
51+
* Used for DataTableActions
52+
*/
4953
secondary?: ReactNode
5054
hasCheckbox?: boolean
5155
/**

packages/components/src/DataTable/Table.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ import { edgeShadow } from './utils/edgeShadow'
4141
import { getNextFocus } from './getNextFocus'
4242

4343
export interface TableProps extends DataTableProps {
44+
/**
45+
* I18n recommended: content that is user visible should be treated for i18n
46+
*/
4447
caption: string
4548
columnsVisible: string[]
4649
}

packages/components/src/Dialog/Confirm/ConfirmLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ import { DialogLayout } from '../Layout'
3131
interface ConfirmLayoutProps {
3232
/**
3333
* Header content
34+
* I18n recommended: content that is user visible should be treated for i18n
3435
*/
3536
title: string
3637

3738
/**
3839
* Primary dialog content
40+
* I18n recommended: content that is user visible should be treated for i18n
3941
*/
4042
message: ReactElement | string
4143
/**

0 commit comments

Comments
 (0)