Skip to content

Commit

Permalink
Aspect Ratio docs (#690)
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
GoldGroove06 and coderabbitai[bot] authored Dec 28, 2024
1 parent 4bdfa8b commit 68e6b1a
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/app/docs/components/aspect-ratio/docs/codeUsage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const code = {
javascript: {
code: `import AspectRatio from "@radui/ui/AspectRatio"`

const AspectRatioExample = () => (
<AspectRatio ratio='16/9'>
<img
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
className="Image"
src="https://images.pexels.com/photos/346529/pexels-photo-346529.jpeg?cs=srgb&dl=pexels-bri-schneiter-28802-346529.jpg&fm=jpg"
alt="Landscape photograph"
/>
</AspectRatio>
)`

}
}


export default code;
47 changes: 47 additions & 0 deletions docs/app/docs/components/aspect-ratio/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const PAGE_NAME = 'ASPECT_RATIO_DOCS'
import Documentation from "@/components/layout/Documentation/Documentation"


import AspectRatio from "@radui/ui/AspectRatio"
import SEO from "../../docsIndex"
export const metadata = SEO.getMetadata(PAGE_NAME)

import codeUsage from "./docs/codeUsage"

const AspectRatioDocs = () => {
const columns = [
{name: 'Prop', key: 'prop'},
{name: 'Type', key: 'type'},
{name: 'Default', key: 'default'},
{name: 'Description', key: 'description'},
];

const data = [
{prop: 'ratio', type: 'string', default: '1', description: 'Used to set desired ratio'},

];
return <div>
<Documentation currentPage={PAGE_NAME} title='Aspect Ratio' description={`
Aspect Ratio is used to set the desired ratio.
`}>
<Documentation.ComponentHero codeUsage={codeUsage}>
<div>
<AspectRatio ratio='16/9'>
<img
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
className="Image"
src="https://images.pexels.com/photos/346529/pexels-photo-346529.jpeg?cs=srgb&dl=pexels-bri-schneiter-28802-346529.jpg&fm=jpg"
alt="Landscape photograph"
/>
</AspectRatio>
</div>
</Documentation.ComponentHero>
<div className="max-w-screen-md">
<Documentation.Table columns={columns} data={data} />
</div>
</Documentation>

</div>
}

export default AspectRatioDocs;
4 changes: 4 additions & 0 deletions docs/components/navigation/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const sections = [
title: "Avatar",
path: "/docs/components/avatar"
},
{
title: "AspectRatio",
path: "/docs/components/aspect-ratio"
},
{
title: "Badge",
path: "/docs/components/badge"
Expand Down

0 comments on commit 68e6b1a

Please sign in to comment.