Skip to content

Commit

Permalink
[Icon]: Ensure consuming apps receive Icon's IconName type instead of…
Browse files Browse the repository at this point in the history
… a bad relative import path (#689)

Consuming apps should know @brave/leo but ../../../ is not the correct relative path from the typescript build output path
  • Loading branch information
petemill committed May 24, 2024
1 parent 3a6f666 commit dac66a2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
16 changes: 8 additions & 8 deletions examples/example-ui-react/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as React from 'react'
import '../../../tokens/css/variables.css'
import LeoButton from '../../../react/button'
import Tooltip from '../../../react/tooltip'
import '@brave/leo/tokens/css/variables.css'
import LeoButton from '@brave/leo/react/button'
import Tooltip from '@brave/leo/react/tooltip'
import Input from '@brave/leo/react/input'
import Dropdown from '@brave/leo/react/dropdown'
import ButtonMenu from '@brave/leo/react/buttonMenu'
import Toggle from '@brave/leo/react/toggle'
import Icon from '@brave/leo/react/icon'
import styles from './App.module.css'
import Input from '../../../react/input'
import Dropdown from '../../../react/dropdown'
import ButtonMenu from '../../../react/buttonMenu'
import Toggle from '../../../react/toggle'
import Icon from '../../../react/icon'

function App() {
// Verify that we can change props and children (slots)
Expand Down
5 changes: 4 additions & 1 deletion examples/example-ui-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"resolveJsonModule": true,
"isolatedModules": true,
"experimentalDecorators": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"paths": {
"@brave/leo/*": ["../../*"]
}
},
"include": ["src"]
}
5 changes: 3 additions & 2 deletions examples/example-ui-react/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ module.exports = function (argv) {
alias: {
svelte: path.resolve('node_modules', 'svelte'),
react: path.resolve('node_modules', 'react'),
['react-dom']: path.resolve('node_modules', 'react-dom'),
['react-router']: path.resolve('node_modules', 'react-router')
'react-dom': path.resolve('node_modules', 'react-dom'),
'react-router': path.resolve('node_modules', 'react-router'),
'@brave/leo': path.resolve(__dirname, '../../')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/icon/icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</script>

<script lang="ts">
import type { IconName } from '../../../icons/meta'
import type { IconName } from '@brave/leo/icons/meta'
export let name: IconName = undefined
export let forceColor: boolean = false
export let title: string = undefined
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"exclude": ["node_modules/*", "__sapper__/*", "public/*"],
"compilerOptions": {
"strictNullChecks": false,
"noImplicitAny": false
"noImplicitAny": false,
"paths": {
// Sometimes we want to preserve @brave/leo for complex paths when providing
// typescript types for the consumer.
"@brave/leo/*": ["./*"]
}
}
}

0 comments on commit dac66a2

Please sign in to comment.