Skip to content

Commit

Permalink
Merge pull request #28 from amosmachora/dev
Browse files Browse the repository at this point in the history
submodular fix
  • Loading branch information
Amos Machora authored Jan 5, 2024
2 parents 2528168 + 15d3b93 commit 8eb0939
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-ladybugs-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-daraja": patch
---

fixed index.ts import issue (submodules)
12 changes: 6 additions & 6 deletions docs-app/components/QrCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const QrCode = () => {

const frontendVanillaReactCode = `
import React, { useEffect, useState } from "react";
import { QRCodeDisplay } from "react-daraja/react";
import { QRCodeDisplayReact } from "react-daraja/react";
import axios from "axios";
const VanillaReactQRCodeExample = () => {
Expand All @@ -83,7 +83,7 @@ export const QrCode = () => {
return (
<>
{qrString ? (
<QRCodeDisplay qrString={qrString} />
<QRCodeDisplayReact qrString={qrString} />
) : (
"show loading spinner or something"
)}
Expand All @@ -107,15 +107,15 @@ export const QrCode = () => {
<CodeBlockWrapper code={nextJSCodeExample} />
<div className="mt-5">
Now if you use vanilla react i.e create-react-app or vite maybe you can
import <CopyPastableSpan text="QRCodeDisplay" /> from react but you have
to fetch the QRString yourself from your backend. For that use case here
is how you might fetch the string in your node backend or next api
import <CopyPastableSpan text="QRCodeDisplayReact" /> from react but you
have to fetch the QRString yourself from your backend. For that use case
here is how you might fetch the string in your node backend or next api
route.
</div>
<CodeBlockWrapper code={backendQRCode} />
<p className="mt-5">
After fetching your QRCode in your backend you can then use the{" "}
<CopyPastableSpan text="QRCodeDisplay" /> from{" "}
<CopyPastableSpan text="QRCodeDisplayReact" /> from{" "}
<CopyPastableSpan text="react-daraja/react" /> to display your QRCode .
Example
</p>
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ import "../index.css";
export * from "./types/types";
export * from "./wrapper-fns";
export * from "./env";
export * from "./util";
export * from "./next";
export * from "./react";
2 changes: 1 addition & 1 deletion src/react/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./QRCodeDisplay";
export { QRCodeDisplay as QRCodeDisplayReact } from "./QRCodeDisplay";
1 change: 1 addition & 0 deletions src/util/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./utils";
11 changes: 10 additions & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src", "!src/wrapper-fns/**", "!src/types/**", "/src/util/**"],
entry: [
// included
"src",
"src/next",
"src/react",
// not-included
"!src/wrapper-fns/**",
"!src/types/**",
"!/src/util/**",
],
dts: true,
format: ["esm", "cjs"],
outDir: "dist",
Expand Down

0 comments on commit 8eb0939

Please sign in to comment.