-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
@@ -4,3 +4,9 @@ export { default as useFetch } from './use-fetch'; | |||
export { default as useWaitForFonts } from './use-wait-for-fonts'; | |||
export { default as useReactRoot } from './use-react-root'; | |||
export { default as useExtendedTheme } from './use-extended-theme'; | |||
export { | |||
default as useMeasureText, | |||
type UseMeasureTextProps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to export types from a single location instead? Ex. src/types
@a-m-dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you create a type file within use-measure-text
folder (which will export all types within the scope of that hook + export everything from that type file from index file of use-measure-text) it will be bundled and also will be accessible through:
import useMeasureText, { your, types, here } from '@qlik/nebula-table-utils/lib/hooks/use-measure-text';
Currently this is the case for HeadCellMenu component as well (but it only exports the flag types from index file, in your case it will be export * from './types'
)
The reason behind it:
if you only wants to use the component -> you have two solutions:
- pull it from
.../lib/components
(which is the best case for only component use) - be more explicit and pull it from index file of the component directory
.../lib/componsnts/MYComponent
(the optional way of importing component, but it has a purpose why it exists 👇)
In your case (+ head cell menu case as well) since we need some extra information from that component (take more types info for example) we have to be more explicit and call it directly from where it is located.
Alternate:
Of course you can import component from .../lib/components
and for it's required types you can be more explicit and retrieve them from components index file, but that is optional (why have 2 lines of import when you can have one -> like HeadCellMenu import in PVT)
So having a global src/types
is not a good idea since in terms of packaging (IMO) because then -> it might include all types from different modules/components/utils and it will ignore the scope of each of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will keep it as it's then
@@ -4,3 +4,9 @@ export { default as useFetch } from './use-fetch'; | |||
export { default as useWaitForFonts } from './use-wait-for-fonts'; | |||
export { default as useReactRoot } from './use-react-root'; | |||
export { default as useExtendedTheme } from './use-extended-theme'; | |||
export { | |||
default as useMeasureText, | |||
type UseMeasureTextProps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you create a type file within use-measure-text
folder (which will export all types within the scope of that hook + export everything from that type file from index file of use-measure-text) it will be bundled and also will be accessible through:
import useMeasureText, { your, types, here } from '@qlik/nebula-table-utils/lib/hooks/use-measure-text';
Currently this is the case for HeadCellMenu component as well (but it only exports the flag types from index file, in your case it will be export * from './types'
)
The reason behind it:
if you only wants to use the component -> you have two solutions:
- pull it from
.../lib/components
(which is the best case for only component use) - be more explicit and pull it from index file of the component directory
.../lib/componsnts/MYComponent
(the optional way of importing component, but it has a purpose why it exists 👇)
In your case (+ head cell menu case as well) since we need some extra information from that component (take more types info for example) we have to be more explicit and call it directly from where it is located.
Alternate:
Of course you can import component from .../lib/components
and for it's required types you can be more explicit and retrieve them from components index file, but that is optional (why have 2 lines of import when you can have one -> like HeadCellMenu import in PVT)
So having a global src/types
is not a good idea since in terms of packaging (IMO) because then -> it might include all types from different modules/components/utils and it will ignore the scope of each of them.
Co-authored-by: Ahmad Mirzaei <[email protected]>
# [2.4.0](v2.3.0...v2.4.0) (2023-09-29) ### Features * use measure text ([#65](#65)) ([33ed1df](33ed1df))
🎉 This PR is included in version 2.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Use the same logic in both table and pivot table to measure text