Skip to content

Commit

Permalink
Integration pages - fix code indentation in snippets (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
iprzybysz authored Jul 26, 2023
1 parent d04f050 commit d5f0fde
Show file tree
Hide file tree
Showing 11 changed files with 199 additions and 188 deletions.
16 changes: 8 additions & 8 deletions site/content/docs/standard/integrations/angular/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,21 @@ <h2 class="text-lg font-bold">Step 2</h2>
<code>tailwind.config.cjs</code> file.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "tailwind.config.cjs" "" "mobile" >}}
{{< twsnippet/code active=true lang="JavaScript" >}}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
content: [
"./src/**/*.{html,ts}",
"./node_modules/tw-elements/dist/js/**/*.js"
],
theme: {
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
}
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand Down Expand Up @@ -198,7 +198,7 @@ <h2 class="text-lg font-bold">Step 4</h2>
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "index.html" "" "mobile" >}}
{{< twsnippet/code active=true lang="HTML" >}}
{{< twsnippet/code active=true lang="HTML" >}}
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900&display=swap"
rel="stylesheet" />
Expand Down
24 changes: 11 additions & 13 deletions site/content/docs/standard/integrations/django/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ <h2 class="text-lg font-bold">Step 5</h2>
{{< twsnippet/code active=true lang="python" >}}
TE_URL = 'node_modules/'
STATICFILES_DIRS = [
BASE_DIR / "static",
BASE_DIR.parent / "node_modules",
BASE_DIR / "static",
BASE_DIR.parent / "node_modules",
]
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand Down Expand Up @@ -202,8 +202,8 @@ <h2 class="text-lg font-bold">Step 2</h2>
<code>tailwind.config.js</code> file.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "tailwind.config.js" "" "mobile" >}}
{{< twsnippet/code active=true lang="JavaScript" >}}
/** @type {import('tailwindcss').Config} */
Expand Down Expand Up @@ -268,7 +268,7 @@ <h2 class="text-lg font-bold">Step 5</h2>
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "home.html" "" "mobile" >}}
{{< twsnippet/code active=true lang="HTML" >}}
{{< twsnippet/code active=true lang="HTML" >}}
<link href="{% static 'output.css' %}" rel="stylesheet" />
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand All @@ -283,7 +283,7 @@ <h2 class="text-lg font-bold">Step 6</h2>
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "home.html" "" "mobile" >}}
{{< twsnippet/code active=true lang="HTML" >}}
{{< twsnippet/code active=true lang="HTML" >}}
<script
src="{% static 'tw-elements/dist/js/tw-elements.umd.min.js' %}"
type="text/javascript"></script>
Expand Down Expand Up @@ -320,7 +320,7 @@ <h2 class="text-lg font-bold">Step 8</h2>
from django.shortcuts import render

def home_view(request):
return render(request, "pages/home.html", {})
return render(request, "pages/home.html", {})
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
</div>
Expand All @@ -341,16 +341,14 @@ <h2 class="text-lg font-bold">Step 9</h2>
from . import views

urlpatterns = [
path("", views.home_view),
path('admin/', admin.site.urls),
path("", views.home_view),
path('admin/', admin.site.urls),
]

if settings.DEBUG:
from django.conf.urls.static import static
urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.TE_URL,
document_root=settings.STATIC_ROOT)
from django.conf.urls.static import static
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.TE_URL, document_root=settings.STATIC_ROOT)
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
</div>
Expand Down
16 changes: 8 additions & 8 deletions site/content/docs/standard/integrations/express/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,19 @@ <h2 class="text-lg font-bold">Step 2</h2>
<code>tailwind.config.cjs</code> file.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "tailwind.config.cjs" "" "mobile" >}}
{{< twsnippet/code active=true lang="JavaScript" >}}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./public/**/*.{html,js,css}",
"./src/**/*.{html,js,css}",
"./node_modules/tw-elements/dist/js/**/*.js",
],
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
content: [
"./public/**/*.{html,js,css}",
"./src/**/*.{html,js,css}",
"./node_modules/tw-elements/dist/js/**/*.js",
],
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
}
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand Down
12 changes: 6 additions & 6 deletions site/content/docs/standard/integrations/laravel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ <h2 class="text-lg font-bold">Step 2</h2>
<code>tailwind.config.cjs</code> file.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "tailwind.config.cjs" "" "mobile" >}}
{{< twsnippet/code active=true lang="JavaScript" >}}
/** @type {import('tailwindcss').Config} */
Expand All @@ -126,12 +126,12 @@ <h2 class="text-lg font-bold">Step 2</h2>
"./resources/**/*.js",
"./resources/**/*.vue",
"./node_modules/tw-elements/dist/js/**/*.js"
],
theme: {
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
}
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand Down
14 changes: 7 additions & 7 deletions site/content/docs/standard/integrations/next/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ <h2 class="text-lg font-bold">Step 2</h2>
<code>tailwind.config.cjs</code> file.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "tailwind.config.cjs" "" "mobile" >}}
{{< twsnippet/code active=true lang="JavaScript" >}}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
content: [
"./app/**/*.{js,ts,jsx,tsx}",
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
Expand All @@ -183,12 +183,12 @@ <h2 class="text-lg font-bold">Step 2</h2>
// Or if using `src` directory:
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/tw-elements/dist/js/**/*.js"
],
theme: {
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
}
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand Down
12 changes: 6 additions & 6 deletions site/content/docs/standard/integrations/nuxt/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ <h2 class="text-lg font-bold">Step 3</h2>
<code>tailwind.config.js</code> file.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "tailwind.config.js" "" "mobile" >}}
{{< twsnippet/code active=true lang="JavaScript" >}}
/** @type {import('tailwindcss').Config} */
Expand All @@ -155,12 +155,12 @@ <h2 class="text-lg font-bold">Step 3</h2>
"./nuxt.config.{js,ts}",
"./app.vue",
"./node_modules/tw-elements/dist/js/**/*.js"
],
theme: {
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
}
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand Down
134 changes: 70 additions & 64 deletions site/content/docs/standard/integrations/react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -482,22 +482,22 @@ <h2 class="text-lg font-bold">Step 2</h2>
<code>tailwind.config.js</code> file.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "tailwind.config.js" "" "mobile">}}
{{< twsnippet/wrapper "tailwind.config.js" "" "mobile" >}}
{{< twsnippet/code active=true lang="JavaScript" >}}
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/tw-elements/dist/js/**/*.js"
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/tw-elements/dist/js/**/*.js"
],
theme: {
extend: {},
},
darkMode: "class",
plugins: [require("tw-elements/dist/plugin.cjs")]
}
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
Expand Down Expand Up @@ -554,34 +554,37 @@ <h2 class="text-lg font-bold">Step 6</h2>
<code>initTE</code>. Initialize <code>initTE</code> in a lifecycle method.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "App.jsx" "" "mobile">}}
{{< twsnippet/code active=true lang="jsx" >}}
import React, { useEffect } from "react";
import { Datepicker, Input, initTE } from "tw-elements";
{{< twsnippet/wrapper "App.jsx" "" "mobile" >}}
{{< twsnippet/code active=true lang="jsx" >}}
import React, { useEffect } from "react";
import { Datepicker, Input, initTE } from "tw-elements";

const App = () => {
useEffect(() => {
const App = () => {
useEffect(() => {
initTE({ Datepicker, Input });
}, []);

return (
<div
className="relative mb-3"
data-te-datepicker-init
data-te-input-wrapper-init>
<input
type="text"
className="peer block min-h-[auto] w-full rounded border-0 bg-transparent px-3 py-[0.32rem] leading-[1.6] outline-none transition-all duration-200 ease-linear focus:placeholder:opacity-100 peer-focus:text-primary data-[te-input-state-active]:placeholder:opacity-100 motion-reduce:transition-none dark:text-neutral-200 dark:placeholder:text-neutral-200 dark:peer-focus:text-primary [&:not([data-te-input-placeholder-active])]:placeholder:opacity-0"
placeholder="Select a date" />
<label
htmlFor="floatingInput"
className="pointer-events-none absolute left-3 top-0 mb-0 max-w-[90%] origin-[0_0] truncate pt-[0.37rem] leading-[1.6] text-neutral-500 transition-all duration-200 ease-out peer-focus:-translate-y-[0.9rem] peer-focus:scale-[0.8] peer-focus:text-primary peer-data-[te-input-state-active]:-translate-y-[0.9rem] peer-data-[te-input-state-active]:scale-[0.8] motion-reduce:transition-none dark:text-neutral-200 dark:peer-focus:text-primary"
>Select a date</label
>
</div>
); }; export default App;
}, []);

return (
<div
className="relative mb-3"
data-te-datepicker-init
data-te-input-wrapper-init>
<input
type="text"
className="peer block min-h-[auto] w-full rounded border-0 bg-transparent px-3 py-[0.32rem] leading-[1.6] outline-none transition-all duration-200 ease-linear focus:placeholder:opacity-100 peer-focus:text-primary data-[te-input-state-active]:placeholder:opacity-100 motion-reduce:transition-none dark:text-neutral-200 dark:placeholder:text-neutral-200 dark:peer-focus:text-primary [&:not([data-te-input-placeholder-active])]:placeholder:opacity-0"
placeholder="Select a date" />
<label
htmlFor="floatingInput"
className="pointer-events-none absolute left-3 top-0 mb-0 max-w-[90%] origin-[0_0] truncate pt-[0.37rem] leading-[1.6] text-neutral-500 transition-all duration-200 ease-out peer-focus:-translate-y-[0.9rem] peer-focus:scale-[0.8] peer-focus:text-primary peer-data-[te-input-state-active]:-translate-y-[0.9rem] peer-data-[te-input-state-active]:scale-[0.8] motion-reduce:transition-none dark:text-neutral-200 dark:peer-focus:text-primary"
>Select a date</label
>
</div>
);
};

export default App;
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
</div>
Expand Down Expand Up @@ -611,41 +614,44 @@ <h2 class="text-lg font-bold">Step 1</h2>
lifecycle hook.
</p>

<!--prettier-ignore-->
<div class="pb-4">
<!--prettier-ignore-->
{{< twsnippet/wrapper "App.jsx" "" "mobile">}}
{{< twsnippet/wrapper "App.jsx" "" "mobile" >}}
{{< twsnippet/code active=true lang="jsx" >}}
import { useEffect } from "react";
import { Datepicker, Input } from "tw-elements";
import { useEffect } from "react";
import { Datepicker, Input } from "tw-elements";

const App = () => {
useEffect(() => {
const App = () => {
useEffect(() => {
const myInput = new Input(document.getElementById("myDatepicker"));
const options = {
format: "dd-mm-yyyy",
format: "dd-mm-yyyy",
};
const myDatepicker = new te.Datepicker(
document.getElementById("myDatepicker"),
options
document.getElementById("myDatepicker"),
options
);
}, []);

return (
<div
className="relative mb-3"
data-te-datepicker-init
data-te-input-wrapper-init>
<input
type="text"
className="peer block min-h-[auto] w-full rounded border-0 bg-transparent px-3 py-[0.32rem] leading-[1.6] outline-none transition-all duration-200 ease-linear focus:placeholder:opacity-100 peer-focus:text-primary data-[te-input-state-active]:placeholder:opacity-100 motion-reduce:transition-none dark:text-neutral-200 dark:placeholder:text-neutral-200 dark:peer-focus:text-primary [&:not([data-te-input-placeholder-active])]:placeholder:opacity-0"
placeholder="Select a date" />
<label
for="floatingInput"
className="pointer-events-none absolute left-3 top-0 mb-0 max-w-[90%] origin-[0_0] truncate pt-[0.37rem] leading-[1.6] text-neutral-500 transition-all duration-200 ease-out peer-focus:-translate-y-[0.9rem] peer-focus:scale-[0.8] peer-focus:text-primary peer-data-[te-input-state-active]:-translate-y-[0.9rem] peer-data-[te-input-state-active]:scale-[0.8] motion-reduce:transition-none dark:text-neutral-200 dark:peer-focus:text-primary"
>Select a date</label
>
</div>
); }; export default App;
}, []);

return (
<div
className="relative mb-3"
data-te-datepicker-init
data-te-input-wrapper-init>
<input
type="text"
className="peer block min-h-[auto] w-full rounded border-0 bg-transparent px-3 py-[0.32rem] leading-[1.6] outline-none transition-all duration-200 ease-linear focus:placeholder:opacity-100 peer-focus:text-primary data-[te-input-state-active]:placeholder:opacity-100 motion-reduce:transition-none dark:text-neutral-200 dark:placeholder:text-neutral-200 dark:peer-focus:text-primary [&:not([data-te-input-placeholder-active])]:placeholder:opacity-0"
placeholder="Select a date" />
<label
for="floatingInput"
className="pointer-events-none absolute left-3 top-0 mb-0 max-w-[90%] origin-[0_0] truncate pt-[0.37rem] leading-[1.6] text-neutral-500 transition-all duration-200 ease-out peer-focus:-translate-y-[0.9rem] peer-focus:scale-[0.8] peer-focus:text-primary peer-data-[te-input-state-active]:-translate-y-[0.9rem] peer-data-[te-input-state-active]:scale-[0.8] motion-reduce:transition-none dark:text-neutral-200 dark:peer-focus:text-primary"
>Select a date</label
>
</div>
);
};

export default App;
{{< /twsnippet/code >}}
{{< /twsnippet/wrapper >}}
</div>
Expand Down
Loading

0 comments on commit d5f0fde

Please sign in to comment.