Skip to content

Commit

Permalink
fix: WEB-625 Update fullwidth prop (#6201)
Browse files Browse the repository at this point in the history
* Update fullwidth prop

* Update width of tablist for full
  • Loading branch information
carlagn authored Aug 19, 2024
1 parent 2a830ca commit 01c7d79
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ To evolve the app, you need to follow the same flow of the tutorial:
The [`prisma-examples`](https://github.com/prisma/prisma-examples/) repository contains a number of ready-to-run examples:
<TabbedContent>
<TabbedContent fullWidth>
<TabItem value="TypeScript">
Expand Down
2 changes: 1 addition & 1 deletion content/100-getting-started/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ _These options don't require you to have your own database running._

_Select one of these options if you want to connect Prisma ORM to your own database._

<TabbedContent gettingStarted>
<TabbedContent>
<TabItem value="New database">
<p>
Set up Prisma ORM <b>from scratch</b> with your favorite database and
Expand Down
7 changes: 4 additions & 3 deletions src/theme/Tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { cloneElement } from "react";
import React, { cloneElement, useEffect } from "react";
import clsx from "clsx";
import {
useScrollPositionBlocker,
Expand Down Expand Up @@ -74,7 +74,7 @@ function TabList({ className, block, selectedValue, selectValue, tabValues }) {
</ul>
);
}
function TabContent({ lazy, children, selectedValue, transparent, code, terminal, customStyles }) {
function TabContent({ lazy, children, selectedValue, transparent, code, terminal, fullWidth, customStyles }) {
const childTabs = (Array.isArray(children) ? children : [children]).filter(Boolean);
if (lazy) {
const selectedTabItem = childTabs.find((tabItem) => tabItem.props.value === selectedValue);
Expand All @@ -87,7 +87,7 @@ function TabContent({ lazy, children, selectedValue, transparent, code, terminal

return (
<div
className={clsx("margin-top--md", transparent && styles.transparent, code && styles.code)}
className={clsx("margin-top--md", transparent && styles.transparent, code && styles.code, fullWidth && styles[`full-width`])}
style={customStyles ? customStyles : {}}
>
{childTabs.map((tabItem, i) =>
Expand All @@ -112,6 +112,7 @@ function TabsComponent(props) {
}
export default function Tabs(props) {
const isBrowser = useIsBrowser();
console.log(props)
return (
<TabsComponent
// Remount tabs after hydration
Expand Down
7 changes: 7 additions & 0 deletions src/theme/Tabs/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@
}
}
}

.full-width {
display: block;
> div > div {
width: 100%;
}
}

0 comments on commit 01c7d79

Please sign in to comment.