Skip to content

Commit

Permalink
feat: add tailwind remix
Browse files Browse the repository at this point in the history
  • Loading branch information
alicanerdurmaz committed May 31, 2024
1 parent 9431afc commit 3c1ffc0
Show file tree
Hide file tree
Showing 31 changed files with 74 additions and 59 deletions.
12 changes: 12 additions & 0 deletions presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,17 @@ module.exports = {
"headless-example": "no",
},
},
{
name: "refine-remix-tailwind",
type: "refine-remix",
answers: {
"ui-framework": "tailwindcss",
"data-provider": "data-provider-custom-json-rest",
"auth-provider": "none",
"antd-example": "no",
"mui-example": "no",
"headless-example": "no",
},
},
],
};
13 changes: 0 additions & 13 deletions refine-nextjs/plugins/tailwindcss/tailwind.config.js

This file was deleted.

28 changes: 13 additions & 15 deletions refine-remix/plugins/_base/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ module.exports = {
const dataProvider = answers["data-provider"];
const authProvider = answers["auth-provider"];
const uiFramework = answers["ui-framework"];
const isHeadless =
uiFramework === "no" || uiFramework === "tailwindcss";

// ## isNextAuthCheck
if (
Expand Down Expand Up @@ -66,7 +68,7 @@ module.exports = {
];

// update for headless
if (uiFramework === "no") {
if (isHeadless) {
base._app.authPageProps = [
`
renderContent={(content) => (
Expand Down Expand Up @@ -116,16 +118,13 @@ module.exports = {
base.selectedSvg = svgFromAnswers;
}

if (
answers["ui-framework"] !== "no" &&
(answers["title"] || answers["svg"])
) {
if (!isHeadless && (answers["title"] || answers["svg"])) {
base._app.localImport.push(
'import { AppIcon } from "@components/app-icon";',
);
}

if (answers["ui-framework"] === "no") {
if (isHeadless) {
base._app.localImport.push(`import styles from "~/global.css";`);
base._app.styleImport.push('{ rel: "stylesheet", href: styles }');
}
Expand Down Expand Up @@ -154,7 +153,7 @@ module.exports = {
} else if (dataProvider === "data-provider-supabase") {
base.blogPostCategoryIdFormField = `"categoryId"`;
} else {
if (uiFramework === "mui" || uiFramework === "no") {
if (uiFramework === "mui" || isHeadless) {
base.blogPostCategoryIdFormField = `"category.id"`;
} else {
base.blogPostCategoryIdFormField = `["category", "id"]`;
Expand All @@ -163,7 +162,7 @@ module.exports = {

// ## blogPostCategoryTableField
if (base.isGraphQL) {
if (uiFramework === "no") {
if (isHeadless) {
base.blogPostCategoryTableField = `"category.title"`;
}
if (uiFramework === "antd") {
Expand Down Expand Up @@ -194,7 +193,7 @@ module.exports = {
{ value: "rejected", label: "Rejected" },
]);
}
if (uiFramework === "no" || uiFramework === "mui") {
if (isHeadless || uiFramework === "mui") {
base.blogPostStatusOptions = JSON.parse(base.blogPostStatusOptions);
}

Expand All @@ -206,17 +205,16 @@ module.exports = {
}

// ## Refine options.title
if (
answers["ui-framework"] !== "no" &&
(answers["title"] || answers["svg"])
) {
if (!isHeadless && (answers["title"] || answers["svg"])) {
if (!base._app.refineOptions) {
base._app.refineOptions = [];
}
const textLine = answers["title"] ? `text: "${answers["title"]}",` : "";
const textLine = answers["title"]
? `text: "${answers["title"]}",`
: "";
const iconLine = answers["svg"] ? `icon: <AppIcon />,` : "";
const template = `title: { ${textLine} ${iconLine} },`;

base._app.refineOptions.push(template);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function Login() {
);
<%_ } _%>

<%_ if (answers["ui-framework"] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
return(
<div
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import {

import { Header } from "@components/header";
import { authenticator } from "~/utils/auth.server";
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { Layout } from "~/components/layout";
<%_ } _%>


export default function BaseLayout() {
return (
<>
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
<Layout>
<Outlet />
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
AuthPage,
} from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
AuthPage,
} from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
AuthPage,
} from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {

import { Header } from "@components/header";
import { authProvider } from "~/authProvider";
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { Layout } from "~/components/layout";
<%_ } _%>

export default function BaseLayout() {
return (
<>
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
<Layout>
<Outlet />
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function Login() {
);
<%_ } _%>

<%_ if (answers["ui-framework"] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
return(
<div
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {

import { Header } from "@components/header";
import { authenticator } from "~/utils/auth.server";
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { Layout } from "~/components/layout";
<%_ } _%>

export default function BaseLayout() {
return (
<>
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
<Layout>
<Outlet />
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function Login() {
);
<%_ } _%>

<%_ if (answers["ui-framework"] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
return(
<div
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {

import { Header } from "@components/header";
import { authenticator } from "~/utils/auth.server";
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { Layout } from "~/components/layout";
<%_ } _%>

export default function BaseLayout() {
return (
<>
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
<Layout>
<Outlet />
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {

import { Header } from "@components/header";
import { authProvider } from "~/authProvider";
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { Layout } from "~/components/layout";
<%_ } _%>

export default function BaseLayout() {
return (
<>
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
<Layout>
<Outlet />
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {

import { Header } from "@components/header";
import { authProvider } from "~/authProvider";
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { Layout } from "~/components/layout";
<%_ } _%>

export default function BaseLayout() {
return (
<>
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
<Layout>
<Outlet />
</Layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<%_ if (answers["ui-framework"] === 'mui') { _%>
import { AuthPage } from "@refinedev/mui";
<%_ } _%>
<%_ if (answers[`ui-framework`] === "no") { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { AuthPage } from "@refinedev/core";
<%_ } _%>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {

import { Header } from "@components/header";
import { authProvider } from "~/authProvider";
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
import { Layout } from "~/components/layout";
<%_ } _%>

export default function BaseLayout() {
return (
<>
<%_ if (answers["ui-framework"] === 'no') { _%>
<%_ if (answers["ui-framework"] === "no" || answers["ui-framework"] === "tailwindcss") { _%>
<Layout>
<Outlet />
</Layout>
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions refine-remix/plugins/tailwindcss/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Config } from "tailwindcss";

export default {
content: ["./app/**/*.{js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
} satisfies Config;
Loading

0 comments on commit 3c1ffc0

Please sign in to comment.