Skip to content

Mimic the new folder structure #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function Component() {
}
```

### \<JetConfirmsPassword />
### \<ConfirmsPassword />

[Source](https://github.com/ozziexsh/laravel-jetstream-react/blob/main/src/stubs/resources/js/Jetstream/ConfirmsPassword.tsx)

Expand All @@ -82,17 +82,17 @@ Make the user confirm their password via a modal before calling a function
If their password was confirmed recently (time configured via laravel config) it skips the modal and just calls the function

```javascript
import JetConfirmsPassword from '@/Jetstream/ConfirmsPassword';
import ConfirmsPassword from '@/Components/ConfirmsPassword';

function Component() {
function changeEmail() {
// only gets called if the password has been verified
}

return (
<JetConfirmsPassword onConfirm={changeEmail}>
<JetButton>Update Email</JetButton>
</JetConfirmsPassword>
<ConfirmsPassword onConfirm={changeEmail}>
<PrimaryButton>Update Email</PrimaryButton>
</ConfirmsPassword>
);
}
```
Expand Down
13 changes: 3 additions & 10 deletions src/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export default class Install extends Command {
this.moveStub('resources/js', 'resources/js');

if (!flags.teams) {
this.removeTeams();
fs.rmSync(path.join(process.cwd(), 'resources', 'js', 'Pages', 'Teams'), {
recursive: true,
});
}

if (!flags.ssr) {
Expand Down Expand Up @@ -185,13 +187,4 @@ export default class Install extends Command {
.map(([key, value]) => `"${key}@${value}"`)
.join(' ');
}

private removeTeams() {
fs.rmSync(path.join(process.cwd(), 'resources', 'js', 'Pages', 'Teams'), {
recursive: true,
});
fs.rmSync(path.join(process.cwd(), 'resources', 'js', 'Domains', 'Teams'), {
recursive: true,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
className?: string;
}

export default function JetActionMessage({
export default function ActionMessage({
on,
className,
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React, { PropsWithChildren } from 'react';
import JetSectionTitle from '@/Jetstream/SectionTitle';
import SectionTitle from '@/Components/SectionTitle';

interface Props {
title: string;
description: string;
}

export default function JetActionSection({
export default function ActionSection({
title,
description,
children,
}: PropsWithChildren<Props>) {
return (
<div className="md:grid md:grid-cols-3 md:gap-6">
<JetSectionTitle title={title} description={description} />
<SectionTitle title={title} description={description} />

<div className="mt-5 md:mt-0 md:col-span-2">
<div className="px-4 py-5 sm:p-6 bg-white shadow sm:rounded-lg">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

export default function JetApplicationLogo({
export default function ApplicationLogo({
className,
}: {
className?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

export default function JetApplicationMark(
export default function ApplicationMark(
props: React.SVGProps<SVGSVGElement>,
) {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { PropsWithChildren } from 'react';
import JetAuthenticationCardLogo from '@/Jetstream/AuthenticationCardLogo';
import AuthenticationCardLogo from '@/Components/AuthenticationCardLogo';

export default function JetAuthenticationCard({
export default function AuthenticationCard({
children,
}: PropsWithChildren<Record<string, unknown>>) {
return (
<div className="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
<div>
<JetAuthenticationCardLogo />
<AuthenticationCardLogo />
</div>

<div className="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { InertiaLink } from '@inertiajs/inertia-react';
import React from 'react';

export default function JetAuthenticationCardLogo() {
export default function AuthenticationCardLogo() {
return (
<InertiaLink href="/">
<svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { usePage } from '@inertiajs/inertia-react';
import classNames from 'classnames';
import React, { useState } from 'react';

export default function JetBanner() {
export default function Banner() {
const [show, setShow] = useState(true);
const { props } = usePage<Page<{ jetstream: any }>>();
const style = props.jetstream.flash?.bannerStyle || 'success';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import React from 'react';

export default function JetCheckbox(
export default function Checkbox(
props: React.DetailedHTMLProps<
React.InputHTMLAttributes<HTMLInputElement>,
HTMLInputElement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PropsWithChildren } from 'react';
import JetModal, { ModalProps } from '@/Jetstream/Modal';
import Modal, { ModalProps } from '@/Components/Modal';

JetConfirmationModal.Content = function JetConfirmationModalContent({
ConfirmationModal.Content = function ConfirmationModalContent({
title,
children,
}: PropsWithChildren<{ title: string }>) {
Expand Down Expand Up @@ -34,15 +34,15 @@ JetConfirmationModal.Content = function JetConfirmationModalContent({
);
};

JetConfirmationModal.Footer = function JetConfirmationModalFooter({
ConfirmationModal.Footer = function ConfirmationModalFooter({
children,
}: PropsWithChildren<Record<string, unknown>>) {
return <div className="px-6 py-4 bg-gray-100 text-right">{children}</div>;
};

export default function JetConfirmationModal({
export default function ConfirmationModal({
children,
...props
}: PropsWithChildren<ModalProps>) {
return <JetModal {...props}>{children}</JetModal>;
return <Modal {...props}>{children}</Modal>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import axios from 'axios';
import classNames from 'classnames';
import React, { PropsWithChildren, useRef, useState } from 'react';
import useRoute from '@/Hooks/useRoute';
import JetButton from '@/Jetstream/Button';
import JetDialogModal from '@/Jetstream/DialogModal';
import JetInput from '@/Jetstream/Input';
import JetInputError from '@/Jetstream/InputError';
import JetSecondaryButton from '@/Jetstream/SecondaryButton';
import DialogModal from '@/Components/DialogModal';
import InputError from '@/Components/InputError';
import PrimaryButton from '@/Components/PrimaryButton';
import TextInput from '@/Components/TextInput';
import SecondaryButton from '@/Components/SecondaryButton';

interface Props {
title?: string;
Expand All @@ -15,7 +15,7 @@ interface Props {
onConfirm(): void;
}

export default function JetConfirmsPassword({
export default function ConfirmsPassword({
title = 'Confirm Password',
content = 'For your security, please confirm your password to continue.',
button = 'Confirm',
Expand Down Expand Up @@ -73,12 +73,12 @@ export default function JetConfirmsPassword({
<span>
<span onClick={startConfirmingPassword}>{children}</span>

<JetDialogModal isOpen={confirmingPassword} onClose={closeModal}>
<JetDialogModal.Content title={title}>
<DialogModal isOpen={confirmingPassword} onClose={closeModal}>
<DialogModal.Content title={title}>
{content}

<div className="mt-4">
<JetInput
<TextInput
type="password"
className="mt-1 block w-3/4"
placeholder="Password"
Expand All @@ -88,22 +88,22 @@ export default function JetConfirmsPassword({
}
/>

<JetInputError message={form.error} className="mt-2" />
<InputError message={form.error} className="mt-2" />
</div>
</JetDialogModal.Content>
</DialogModal.Content>

<JetDialogModal.Footer>
<JetSecondaryButton onClick={closeModal}>Cancel</JetSecondaryButton>
<DialogModal.Footer>
<SecondaryButton onClick={closeModal}>Cancel</SecondaryButton>

<JetButton
<PrimaryButton
className={classNames('ml-2', { 'opacity-25': form.processing })}
onClick={confirmPassword}
disabled={form.processing}
>
{button}
</JetButton>
</JetDialogModal.Footer>
</JetDialogModal>
</PrimaryButton>
</DialogModal.Footer>
</DialogModal>
</span>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = React.DetailedHTMLProps<
HTMLButtonElement
>;

export default function JetDangerButton({
export default function DangerButton({
children,
...props
}: PropsWithChildren<Props>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PropsWithChildren } from 'react';
import JetModal, { ModalProps } from '@/Jetstream/Modal';
import Modal, { ModalProps } from '@/Components/Modal';

JetDialogModal.Content = function JetDialogModalContent({
DialogModal.Content = function DialogModalContent({
title,
children,
}: PropsWithChildren<{ title: string }>) {
Expand All @@ -14,15 +14,15 @@ JetDialogModal.Content = function JetDialogModalContent({
);
};

JetDialogModal.Footer = function JetDialogModalFooter({
DialogModal.Footer = function DialogModalFooter({
children,
}: PropsWithChildren<Record<string, unknown>>) {
return <div className="px-6 py-4 bg-gray-100 text-right">{children}</div>;
};

export default function JetDialogModal({
export default function DialogModal({
children,
...modalProps
}: PropsWithChildren<ModalProps>) {
return <JetModal {...modalProps}>{children}</JetModal>;
return <Modal {...modalProps}>{children}</Modal>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
renderTrigger(): JSX.Element;
}

export default function JetDropdown({
export default function Dropdown({
align = 'right',
width = '48',
contentClasses = 'py-1 bg-white',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
href?: string;
}

export default function JetDropdownLink({
export default function DropdownLink({
as,
href,
children,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import React, { PropsWithChildren } from 'react';
import JetSectionTitle from '@/Jetstream/SectionTitle';
import SectionTitle from '@/Components/SectionTitle';

interface Props {
title: string;
Expand All @@ -9,7 +9,7 @@ interface Props {
onSubmit(): void;
}

export default function JetFormSection({
export default function FormSection({
onSubmit,
renderActions,
title,
Expand All @@ -20,7 +20,7 @@ export default function JetFormSection({

return (
<div className="md:grid md:grid-cols-3 md:gap-6">
<JetSectionTitle title={title} description={description} />
<SectionTitle title={title} description={description} />

<div className="mt-5 md:mt-0 md:col-span-2">
<form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Props {
className?: string;
}

export default function JetInputError({
export default function InputError({
message,
className,
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface Props {
htmlFor?: string;
}

export default function JetLabel({
export default function InputLabel({
value,
htmlFor,
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface ModalProps {
maxWidth?: string;
}

export default function JetModal({
export default function Modal({
isOpen,
onClose,
maxWidth = '2xl',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Props {
active?: boolean;
}

export default function JetNavLink({
export default function NavLink({
active,
href,
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = React.DetailedHTMLProps<
HTMLButtonElement
>;

export default function JetButton({
export default function PrimaryButton({
children,
...props
}: PropsWithChildren<Props>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props =
href: string;
};

export default function JetResponsiveNavLink({
export default function ResponsiveNavLink({
active,
href,
children,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = React.DetailedHTMLProps<
HTMLButtonElement
>;

export default function JetSecondaryButton({
export default function SecondaryButton({
children,
...props
}: PropsWithChildren<Props>) {
Expand Down
Loading