g-loot / react-tournament-brackets

React component library for displaying bracket leaderboards
https://sleepy-kare-d8538d.netlify.app/?path=/story/components-bracket--bracket
GNU Lesser General Public License v2.1
220 stars 69 forks source link

Can't import createThemes #14

Closed adrian-kong closed 2 years ago

adrian-kong commented 2 years ago

Using the example code

import { ..., createTheme } from '@g-loot/react-tournament-brackets';

const WhiteTheme = createTheme({
    ...
});

I'm getting Uncaught TypeError: (0 , _g_loot_react_tournament_brackets__WEBPACK_IMPORTED_MODULE_0__.createTheme) is not a function

and with further inspection,

...
import SVGViewer from './src/svg-viewer';
export { SingleEliminationBracket, DoubleEliminationBracket, Match, MATCH_STATES, SVGViewer, };

The SVGViewer is also not found in the index.d.ts on latest version 1.0.15 path /src/svg-viewer not found

I'm pretty new to react so I'm not sure I'm doing this right but would love to use this great library

Thanks

Shenato commented 2 years ago

It looks like I forgot to even export createTheme, that's my bad. 😓 Fixing it ASAP

Shenato commented 2 years ago

Opened a PR now just waiting for someone from G-loot to approve since I don't have write access here anymore. 😅 https://github.com/g-loot/react-tournament-brackets/pull/15

adrian-kong commented 2 years ago

Ty! Is the svg-viewer missing an issue or just my side? (/src folder only has type.d.ts and folders no svg-viewer file)

Shenato commented 2 years ago

When you import it does it throw an error similar to createTheme?

Shenato commented 2 years ago

If I remmeber correctly, this package should be shipping a js bundle without much of the original source code files and type files for intellisense and typescript support.

So if src doesn't have the same source code in it and you're able to import stuff then there's no problems there, only createTheme was missing as far as I can see in the source code. I've used the package myself and I've imported and used everything except createTheme so that probably explains why I never found out by myself that I forgot to export it. Hope this answers your question! Just import and use stuff like in the documentation and if you get an error then there's issues otherwise don't worry what the package looks like on your local machine, the source code is most likely just bundled into a single js file that is obfuscated and minified.

adrian-kong commented 2 years ago

Ah yeah there's no errors, that's good to know ty!