Skip to content

Commit

Permalink
Add missing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-leamon committed May 23, 2024
1 parent d1eb748 commit 9507396
Show file tree
Hide file tree
Showing 20 changed files with 120 additions and 91 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"version": "1.0.125",
"version": "1.0.126",
"description": "Formation is a comprehensive component library powered by React, Styled Components, and CSS variables for creating apps and websites that demand responsive, unified cross-platform experiences.",
"resolutions": {
"string-width": "^4",
Expand Down
24 changes: 14 additions & 10 deletions src/components/Checkboxes/Checkboxes.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types'
import React, { useState } from 'react'
import React from 'react'
import styled from 'styled-components'

import { Icon, Box, LineBreak, Gap, Item, ItemProps } from '../../internal'
import { Box, LineBreak, Item, ItemProps } from '../../internal'

// @ts-ignore
interface Props extends ItemProps {
options: ItemProps[],
value: string[],
Expand Down Expand Up @@ -48,19 +48,23 @@ export const Checkboxes = (props : Props) => {
return <S.Checkboxes minimal={minimal || false}><Box wrap width='100%'>
{
(icon || label) &&
<Item
label={label} icon={icon} iconPrefix={iconPrefix}
{
...props
}
/>
// @ts-ignore
<Item
label={label} icon={icon} iconPrefix={iconPrefix}
{
...props
}
/>
}

{ !minimal && <LineBreak light />}

{
options.map((option, index) =>
<S.OptionLabel htmlFor={option.name}>
<S.OptionLabel
key={index}
htmlFor={option.name}
>
<Item
{
...option
Expand Down
2 changes: 0 additions & 2 deletions src/components/DateAndTimePicker/DateAndTimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ export const DateAndTimePicker = ({
}

const setValue = (index: number, field: 'date' | 'startTime' | 'endTime', fieldValue: string) => {

console.log(value, 'value')
onChange(
value?.map((day, i) =>
index === i
Expand Down
2 changes: 1 addition & 1 deletion src/components/Fit/Fit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const Fit: React.FC<FitProps> = ({ children, disableRadius, gap }) => {
<S.Fit disableRadius={disableRadius} gap={gapValue}>
{
React.Children.map(children, child => (
<>{child}</>
<>{ child }</>
))
}
</S.Fit>
Expand Down
3 changes: 2 additions & 1 deletion src/components/LabelColorPicker/LabelColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ const Dropdown = ({

return <S.DropdownDropdown ref={scrollContainerRef}>
{
options.map(item =>
options.map((item, index) =>
<LabelColorCircle
key={index}
labelColor={item as any}
ref={value === item ? scrollToRef : null}
onClick={() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/LabelManager/LabelManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const LabelManager = ({ value, onChange }: Props) => {
{
value.map(({ name, description, labelColor }, index) =>
<>
<Box p={.5}>
<Box p={.5} key={index}>
<Gap autoWidth={true}>
{
editingIndex === index
Expand Down
6 changes: 5 additions & 1 deletion src/components/ListEditor/ExpandableLists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ export const ExpandableLists = ({
: <>
{
value?.map((expandableList, index) =>
<ExpandableList {...expandableList} onExpand={() => onExpand(index)}/>
<ExpandableList
key={index}
{...expandableList}
onExpand={() => onExpand(index)}
/>
)
}
</>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ListEditor/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ export const List = React.memo(({
placeholder={<Item primary={true} name={' '} labelColor='none' />}
>
{
value.map(props => <Item {...props} indent={indent}/>)
value.map((props, index) => <Item key={index} {...props} indent={indent}/>)
}
</Reorder>
: <>
{
value.map(props => <Item {...props} indent={indent} />)
value.map((props, index) => <Item key={index} {...props} indent={indent} />)
}
</>
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/NavSpaces/Channels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ export const Channels = ({ channels }: Props) => {
}

{
channels?.map(channel =>
channels?.map((channel, index) =>
channel.name
? <Item
key={index}
icon={channel.icon}
iconPrefix={channel.iconPrefix}
href={channel.href}
Expand Down
52 changes: 27 additions & 25 deletions src/components/Sliders/RC-Slider/Handles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,35 @@ const Handles = React.forwardRef((props: HandlesProps, ref: React.Ref<HandlesRef

return (
<>
{values.map((value, index) => (
<Handle
ref={(node) => {
if (!node) {
delete handlesRef.current[index];
} else {
handlesRef.current[index] = node;
}
}}
dragging={draggingIndex === index}
prefixCls={prefixCls}
style={getIndex(style, index)}
key={index}
value={value}
valueIndex={index}
onStartMove={onStartMove}
onOffsetChange={onOffsetChange}
render={handleRender}
{...restProps}
/>
))}
{
values.map((value, index) => (
<Handle
ref={(node) => {
if (!node) {
delete handlesRef.current[index];
} else {
handlesRef.current[index] = node;
}
}}
dragging={draggingIndex === index}
prefixCls={prefixCls}
style={getIndex(style, index)}
key={index}
value={value}
valueIndex={index}
onStartMove={onStartMove}
onOffsetChange={onOffsetChange}
render={handleRender}
{...restProps}
/>
))
}
</>
);
});
)
})

if (process.env.NODE_ENV !== 'production') {
Handles.displayName = 'Handles';
Handles.displayName = 'Handles'
}

export default Handles;
export default Handles
26 changes: 14 additions & 12 deletions src/components/Sliders/RC-Slider/Marks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ export default function Marks(props: MarksProps) {

return (
<div className={markPrefixCls}>
{/* @ts-ignore */}
{marks.map(({ value, style, label }) => (
<Mark
key={value}
prefixCls={markPrefixCls}
style={style}
value={value}
onClick={onClick}
>
{label}
</Mark>
))}
{
// @ts-ignore
marks.map(({ value, style, label }) => (
<Mark
key={value}
prefixCls={markPrefixCls}
style={style}
value={value}
onClick={onClick}
>
{label}
</Mark>
))
}
</div>
);
}
20 changes: 11 additions & 9 deletions src/components/Sliders/RC-Slider/Steps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ export default function Steps(props: StepsProps) {

return (
<div className={`${prefixCls}-step`}>
{stepDots.map((dotValue) => (
<Dot
prefixCls={prefixCls}
key={dotValue}
value={dotValue}
style={style}
activeStyle={activeStyle}
/>
))}
{
stepDots.map((dotValue, index) => (
<Dot
prefixCls={prefixCls}
key={dotValue}
value={dotValue}
style={style}
activeStyle={activeStyle}
/>
))
}
</div>
);
}
7 changes: 5 additions & 2 deletions src/components/Steps/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ export const Steps = React.memo(({
return (
<S.Steps>
{
new Array(numberOfSteps).fill(0).map((step, stepIndex) =>
<S.Step active={stepIndex <= activeStepIndex} />
new Array(numberOfSteps).fill(0).map((_, stepIndex) =>
<S.Step
key={stepIndex}
active={stepIndex <= activeStepIndex}
/>
)
}
</S.Steps>
Expand Down
9 changes: 4 additions & 5 deletions src/components/Tags/Tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ export const Tags = ({
<S.Tags ref={ref} onScroll={onScroll} noPadding={noPadding}>
{
allTags.map((tag, index) =>

tag.name !== undefined
?<S.ButtonContainer key={`tag${index}`}>
? <S.ButtonContainer key={`tag${index}`}>
<Button
text={tag.name}
primary={activeTags.includes(tag.name)}
Expand All @@ -108,9 +107,9 @@ export const Tags = ({
labelColor={tag.labelColor}
compact
/>
</S.ButtonContainer>
:<></>)

</S.ButtonContainer>
: <></>
)
}
<S.Padding_R />
</S.Tags>
Expand Down
3 changes: 1 addition & 2 deletions src/components/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,8 @@ export const TextInput = React.memo(({
&& <Box mr={-.5}>
<S.Divider />
{
buttons.map(buttonProps => <Button {...buttonProps}/>)
buttons.map((buttonProps, index) => <Button key={index} {...buttonProps}/>)
}

</Box>
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/Tile/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export const Tile = ({
footers &&
<S.Footers>
{
footers.map(footer =>
<S.FooterWrapper>
footers.map((footer, index) =>
<S.FooterWrapper key={index}>
<Item { ...footer } />
</S.FooterWrapper>
)
Expand Down
5 changes: 4 additions & 1 deletion src/components/TileGridPlaceholder/TileGridPlaceholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export const TileGridPlaceholder = React.memo(({
<Grid maxWidth={maxWidth} gap={.125}>
{
Array(tiles).fill(0).map((_, index) =>
<S.TilePlaceholder disableRounded={disableRounded}>
<S.TilePlaceholder
disableRounded={disableRounded}
key={index}
>
<AspectRatio ratio={4/3}>
</AspectRatio>
</S.TilePlaceholder>
Expand Down
1 change: 0 additions & 1 deletion src/components/TimePicker/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ const Times = ({
'11:00 PM',
'11:30 PM',
].map((item, index) =>

<S.Item
key={index}
onClick={() => {
Expand Down
26 changes: 19 additions & 7 deletions src/components/Timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,13 @@ export const Clip = ({
}}
>
{
clipData.previews.map(preview =>
<img src={preview} style={{height: '100%'}} draggable="false" />
clipData.previews.map((preview, index) =>
<img
src={preview}
style={{height: '100%'}}
draggable="false"
key={index}
/>
)
}
</Tk.DragHandleInner>
Expand Down Expand Up @@ -250,8 +255,9 @@ export const Track = ({
return (
<L.Track>
{
clipData.map(clip =>
clipData.map((clip, index) =>
<Clip
key={index}
width={((clip.out - clip.in) / totalDuration) * 100}
offset={(clip.offset / totalDuration) * 100}
clipData={clip}
Expand Down Expand Up @@ -1040,8 +1046,11 @@ export const Timeline = ({ }: TimelineProps) => {
mediaMode === 'grid'
? <Grid maxWidth={mediaMode === 'grid' ? mediaZoom : 100} gap={.25}>
{
clipData.filter(clip => clip.name.toLowerCase().includes(mediaSearch)).map(clip =>
<DragOrigin data={{origin: 'media', clip}}>
clipData.filter(clip => clip.name.toLowerCase().includes(mediaSearch)).map((clip, index) =>
<DragOrigin
key={index}
data={{origin: 'media', clip}}
>
<VideoPreview
text={`${clip.name.slice(0, 10)}...`}
imageUrl={clip.previews[0]}
Expand All @@ -1055,8 +1064,11 @@ export const Timeline = ({ }: TimelineProps) => {
</Grid>
: <Gap>
{
clipData.filter(clip => clip.name.toLowerCase().includes(mediaSearch)).map(clip =>
<DragOrigin data={{origin: 'media', clip}}>
clipData.filter(clip => clip.name.toLowerCase().includes(mediaSearch)).map((clip, index) =>
<DragOrigin
key={index}
data={{origin: 'media', clip}}
>
<Item
text={clip.name}
subtitle={`${clip.type} - ${clip.dimensions.width}x${clip.dimensions.height}`}
Expand Down
Loading

0 comments on commit 9507396

Please sign in to comment.