Skip to content

Commit

Permalink
fix layout padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeesun Kim authored and Jeesun Kim committed Mar 14, 2024
1 parent 1499bbb commit 07c554f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
18 changes: 17 additions & 1 deletion src/app/(sidebar)/account/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
"use client";
import { useRouter } from "next/navigation";
import { Card, Text, Button } from "@stellar/design-system";
import { Keypair } from "stellar-sdk";

import { GenerateKeypair } from "@/components/GenerateKeypair";
import { Routes } from "@/constants/routes";
import { useStore } from "@/store/useStore";

import "../styles.scss";

export default function CreateAccount() {
const { account } = useStore();
const router = useRouter();

const generateKeypair = () => {
let keypair = Keypair.random();

account.updateKeypair({
publicKey: keypair.publicKey(),
secretKey: keypair.secret(),
});
};

return (
<div className="Account">
<Card>
Expand All @@ -26,7 +38,9 @@ export default function CreateAccount() {
</Text>
</div>
<div className="Account__CTA">
<GenerateKeypair />
<Button size="md" variant="tertiary" onClick={generateKeypair}>
Generate keypair
</Button>

<Button
size="md"
Expand All @@ -36,6 +50,8 @@ export default function CreateAccount() {
Fund account with Friendbot
</Button>
</div>

<GenerateKeypair />
</div>
</Card>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(sidebar)/account/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

&__CTA {
display: flex;
gap: pxToRem(18px);
gap: pxToRem(18px) pxToRem(8px);
}
&__keypair {
display: flex;
Expand Down
16 changes: 1 addition & 15 deletions src/components/GenerateKeypair.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import { Button, Icon, Input } from "@stellar/design-system";
import { Keypair } from "stellar-sdk";
import { Icon, Input } from "@stellar/design-system";
import { useStore } from "@/store/useStore";

export const GenerateKeypair = () => {
const { account } = useStore();

const generateKeypair = () => {
let keypair = Keypair.random();

account.updateKeypair({
publicKey: keypair.publicKey(),
secretKey: keypair.secret(),
});
};

return (
<div className="Account__keypair">
<Button size="md" variant="tertiary" onClick={generateKeypair}>
Generate keypair
</Button>

{account.keypair.publicKey && (
<Input
readOnly
Expand Down

0 comments on commit 07c554f

Please sign in to comment.