Skip to content

Commit

Permalink
Refactor Icon types: Remove Icon.ts, add IconType.ts and AnimatedIcon…
Browse files Browse the repository at this point in the history
…Type.ts, update imports.
  • Loading branch information
ohrytskov committed Oct 24, 2024
1 parent 1d69144 commit 4a50c77
Show file tree
Hide file tree
Showing 89 changed files with 110 additions and 114 deletions.
9 changes: 9 additions & 0 deletions src/@types/AnimatedIconType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ReactNode } from 'react'
import IconType from './IconType'

interface AnimatedIconType extends IconType {
animationData?: object
children?: ReactNode
}

export default AnimatedIconType
28 changes: 0 additions & 28 deletions src/@types/Icon.ts

This file was deleted.

15 changes: 15 additions & 0 deletions src/@types/IconType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react'
import { SystemStyleObject } from '../../styled-system/types'

interface IconType {
cssRaw?: SystemStyleObject
fill?: string
height?: number
size?: number
style?: React.CSSProperties
width?: number
animated?: boolean
animationComplete?: () => void
}

export default IconType
2 changes: 1 addition & 1 deletion src/@types/Shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { GestureResponderEvent } from 'react-native'
import Dispatch from './Dispatch'
import GesturePath from './GesturePath'
import Icon from './Icon'
import Icon from './IconType'
import Key from './Key'
import MulticursorFilter from './MulticursorFilter'
import Path from './Path'
Expand Down
2 changes: 1 addition & 1 deletion src/components/QuickDropIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { css } from '../../styled-system/css'
import DragAndDropType from '../@types/DragAndDropType'
import DragThoughtItem from '../@types/DragThoughtItem'
import DragThoughtZone from '../@types/DragThoughtZone'
import IconType from '../@types/Icon'
import IconType from '../@types/IconType'
import State from '../@types/State'
import { alertActionCreator as alert } from '../actions/alert'
import { dragInProgressActionCreator as dragInProgress } from '../actions/dragInProgress'
Expand Down
2 changes: 1 addition & 1 deletion src/components/RedoIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../@types/Icon'
import IconType from '../@types/IconType'
import AnimatedIcon from './icons/AnimatedIcon'
import animationData from './icons/animations/02-redo_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../@types/Icon'
import IconType from '../@types/IconType'
import AnimatedIcon from './icons/AnimatedIcon'
import animationData from './icons/animations/12-search.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/ToolbarButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'
import { css } from '../../styled-system/css'
import { token } from '../../styled-system/tokens'
import DragShortcutZone from '../@types/DragShortcutZone'
import Icon from '../@types/Icon'
import Icon from '../@types/IconType'
import ShortcutId from '../@types/ShortcutId'
import { isTouch } from '../browser'
import useDragAndDropToolbarButton from '../hooks/useDragAndDropToolbarButton'
Expand Down
2 changes: 1 addition & 1 deletion src/components/TriangleDown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '../../styled-system/css'
import Icon from '../@types/Icon'
import Icon from '../@types/IconType'

/** A down-facing triangle component. */
const TriangleDown = ({ fill = 'black', size = 20, width, height, style, cssRaw }: Icon) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/TriangleLeft.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '../../styled-system/css'
import Icon from '../@types/Icon'
import Icon from '../@types/IconType'

/** A left-facing svg triangle. */
const TriangleLeft = ({ fill = 'black', size = 20, width, height, style, cssRaw }: Icon) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/TriangleRight.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '../../styled-system/css'
import Icon from '../@types/Icon'
import Icon from '../@types/IconType'

/** A right-facing triangle component. */
const TriangleRight = ({ fill = 'black', size = 20, width, height, style, cssRaw }: Icon) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/UndoIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../@types/Icon'
import IconType from '../@types/IconType'
import AnimatedIcon from './icons/AnimatedIcon'
import animationData from './icons/animations/01-undo_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/AnimatedIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from 'react'
import { css, cx } from '../../../styled-system/css'
import { icon } from '../../../styled-system/recipes'
import { token } from '../../../styled-system/tokens'
import { AnimatedIconType } from '../../@types/Icon'
import AnimatedIconType from '../../@types/AnimatedIconType'
import { ICON_SCALING_FACTOR } from '../../constants'
import LottieAnimation from './LottieAnimation'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/ArchiveIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/22-trash_3.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/BackIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/06-back.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/BoldTextIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/13-bold_4.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/BumpThoughtDownIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/14-bump-thought-down_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/Check.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/12-mark-as-done_3.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/ClearThoughtIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/25-clear-thought.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/CollapseIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/26-collaps_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/CommandLibraryIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC } from 'react'
import { css, cx } from '../../../styled-system/css'
import { icon } from '../../../styled-system/recipes'
import { token } from '../../../styled-system/tokens'
import Icon from '../../@types/Icon'
import Icon from '../../@types/IconType'

/** Command Library icon that looks like a finger pressing a button. */
const CommandLibraryIcon: FC<Icon> = ({ cssRaw, fill, style, size = 20 }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/CommandPaletteIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/27-command-palette.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/ContextViewIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/18-context-view_3.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/ConvertToNoteIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/24-convert-to-note.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/CopyClipboard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css, cx } from '../../../styled-system/css'
import { icon } from '../../../styled-system/recipes'
import { token } from '../../../styled-system/tokens'
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import { ICON_SCALING_FACTOR } from '../../constants'

/** Copy Clipboard icon. */
Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/DeleteIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/31-parmanently-delete_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/DeviceIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/26-device-management_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/DownloadIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { css, cx } from '../../../styled-system/css'
import { icon } from '../../../styled-system/recipes'
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'

/** Download icon. */
const DownloadIcon = ({ fill, size = 20, style, cssRaw }: IconType) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/ExtractThoughtIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/28-extract_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/FavoritesIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/04-favorite_3.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/GenerateThoughtIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/29-generate-thought_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/Heading1Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/18-heading-one.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/Heading2Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/19-heading-two.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/Heading3Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/20-heading-three.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/Heading4Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/21-heading-four.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/Heading5Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/22-heading-five.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/HelpIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/13-help_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/HiddenThoughtsIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/24-show-hidden-thoughts_4.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/HomeIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useSelector } from 'react-redux'
import { css, cx } from '../../../styled-system/css'
import { token } from '../../../styled-system/tokens'
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'

/** A home icon. */
const HomeIcon = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/HomeToolbarIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/11-home.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/IndentIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/06-indent_2.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/ItalicTextIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/14-italic_4.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/JoinThoughtsIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/30-join-thought.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/JumpBackIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/07-jump-back.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/JumpForwardIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/08-jump-forward.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/LetterCaseIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css, cx } from '../../../styled-system/css'
import { icon } from '../../../styled-system/recipes'
import { token } from '../../../styled-system/tokens'
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import { ICON_SCALING_FACTOR } from '../../constants'

/** Letter-case icon. */
Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/LetterCaseWithPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useRef } from 'react'
import { useSelector } from 'react-redux'
import { CSSTransition } from 'react-transition-group'
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import LetterCasePicker from '../LetterCasePicker'
import LetterCaseIcon from './LetterCaseIcon'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/LowerCaseIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css, cx } from '../../../styled-system/css'
import { icon } from '../../../styled-system/recipes'
import { token } from '../../../styled-system/tokens'
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import { ICON_SCALING_FACTOR } from '../../constants'

/** Lower-Case icon. */
Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/MetaIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC } from 'react'
import { css, cx } from '../../../styled-system/css'
import { icon } from '../../../styled-system/recipes'
import { token } from '../../../styled-system/tokens'
import Icon from '../../@types/Icon'
import Icon from '../../@types/IconType'

/** Meta icon that shows code under a magnifying glass. */
// https://thenounproject.com/icon/inspect-element-4199164/
Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/MoveCursorBackwardIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/16-move-thought-up.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/MoveCursorForwardIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/15-move-thought-down.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/MoveThoughtDownIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/15-move-thought-down.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/MoveThoughtUpIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/16-move-thought-up.json'

Expand Down
2 changes: 1 addition & 1 deletion src/components/icons/NewSubthoughtAboveIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import IconType from '../../@types/Icon'
import IconType from '../../@types/IconType'
import AnimatedIcon from './AnimatedIcon'
import animationData from './animations/03-new-subthought-above_2.json'

Expand Down
Loading

0 comments on commit 4a50c77

Please sign in to comment.