forked from primefaces/primereact
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: primefaces#5644 Add missing tailwind styles (primefaces#7123)
* feat: primefaces#5644 Add missing tailwind styles - Add tailwinddoc for floatlabel - Fix typing for floatlabel * chore: primefaces#5644 Fix typing * Update floatlabeldoc.js * Update floatlabeldoc.js * Update floatlabeldoc.js * Update basicdoc.js * Update floatlabeldoc.js * Update floatlabeldoc.js * Update floatlabeldoc.js * Update floatlabeldoc.js * Update floatlabeldoc.js * Update primereact.all.js * Update floatlabeldoc.js * Update floatlabeldoc.js --------- Co-authored-by: Melloware <mellowaredev@gmail.com>
- Loading branch information
Showing
8 changed files
with
97 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,63 @@ | ||
import { DocSectionCode } from '@/components/doc/common/docsectioncode'; | ||
import { DocSectionText } from '@/components/doc/common/docsectiontext'; | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
|
||
export function TailwindDoc(props) { | ||
const code = { | ||
basic: ` | ||
const Tailwind = { | ||
floatlabel: { | ||
root: { | ||
className: classNames( | ||
'block relative', // root component style | ||
'[&>label]:absolute [&>label]:pointer-events-none [&>label]:left-2 [&>label]:top-1/2 [&>label]:-mt-2 [&>label]:leading-none [&>label]:transition-all [&>label]:ease-in-out', // label style | ||
'[&>textarea~label]:top-4', // textarea | ||
'[&>input:focus~label]:-top-3 [&>input:focus~label]:text-xs', // input focus | ||
'[&>input:autofill~label]:-top-3 [&>input:autofill~label]:text-xs', // input autofill | ||
'[&>input.p-filled~label]:-top-3 [&>input.p-filled~label]:text-xs', // input filled | ||
'[&>textarea:focus~label]:-top-3 [&>textarea:focus~label]:text-xs', // textarea focus | ||
'[&>textarea.p-filled~label]:-top-3 [&>textarea.p-filled~label]:text-xs', // textarea filled | ||
'[&>div[data-pc-name="dropdown"][data-p-focus="false"]~label]:-top-3 [&>div[data-pc-name="dropdown"][data-p-focus="false"]~label]:text-xs', // dropdown focus | ||
'[&>input::placeholder]:opacity-0 [&>input::placeholder]:transition-all [&>input::placeholder]:ease-in-out', // placeholder | ||
'[&>input::placeholder:focus]:opacity-100 [&>input::placeholder:focus]:transition-all [&>input::placeholder:focus]:ease-in-out' // placeholder focus | ||
) | ||
} | ||
}, | ||
} | ||
` | ||
}; | ||
|
||
const code2 = { | ||
javascript: ` | ||
import React from 'react'; | ||
import { FloatLabel } from 'primereact/floatlabel'; | ||
import { InputText } from 'primereact/inputtext'; | ||
export default function BasicDemo() { | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<FloatLabel> | ||
<InputText id="username" value={value} onChange={(e) => setValue(e.target.value)} /> | ||
<label htmlFor="username">Username</label> | ||
</FloatLabel> | ||
</div> | ||
) | ||
} | ||
` | ||
}; | ||
|
||
export function TailwindDoc() { | ||
return ( | ||
<DocSectionText id="tailwind" label="Tailwind"> | ||
<p> | ||
Visit{' '} | ||
<Link href="https://github.com/primefaces/primereact-tailwind" target="_blank" rel="noopener noreferrer"> | ||
Tailwind Presets | ||
</Link>{' '} | ||
project for detailed documentation, examples and ready-to-use presets about how to style PrimeReact components with Tailwind CSS. | ||
</p> | ||
</DocSectionText> | ||
<> | ||
<DocSectionText {...props}> | ||
<p> | ||
PrimeReact offers a built-in Tailwind theme to get you started quickly. The default values related to the component are displayed below. The component can easily be styled with your own design based on Tailwind utilities, see the{' '} | ||
<Link href="/tailwind">Tailwind Customization</Link> section for an example. | ||
</p> | ||
<DocSectionCode code={code} hideToggleCode import hideStackBlitz /> | ||
<p>A playground sample with the pre-built Tailwind theme.</p> | ||
<DocSectionCode code={code2} embedded /> | ||
</DocSectionText> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters