Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Tabs): reset spacings #2312

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/docs/vibe-3-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ codemod: `avatar-component-migration`

- `isOnPrimary` removed, use `color={StepsColor.PRIMARY}` instead [codemod]

### Tabs

- Reset spacings (removed default browser's margin/padding for ul,li elements)

### TabList

- `noPadding` is removed as it's the default, component no longer gets a default padding bottom
Expand Down Expand Up @@ -206,12 +210,10 @@ codemod: `avatar-component-migration`

- `ColorPicker.COLOR_STYLES` removed [codemod]


### ColorPickerContent

- `ColorPickerContent.COLOR_STYLES` removed [codemod]


## Hooks

### useClickableProps
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/components/Tabs/Tab/Tab.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
color: var(--primary-text-color);
text-align: center;
height: 100%;
margin: 0;
}

.tabWrapper:after {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
position: relative;
height: 40px;
outline: none;
padding: 0;
}

.tabsWrapper .tabsList.sm {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from "react";
import TabList, { TabListProps } from "../TabList";
import Tab from "../../Tab/Tab";
import styles from "./TabList.stories.module.scss";
import { Flex } from "../../../Flex";
import { Heading } from "../../../Heading";

export default {
title: "Navigation/Tabs/TabList",
Expand Down Expand Up @@ -56,9 +57,9 @@ export const Stretched = {

export const Sizes = {
render: () => (
<div className={styles.tabsSizesContainer}>
<Flex direction="column" align="start" gap="small">
<>
Small
<Heading type="h3">Small</Heading>
<TabList size="sm">
<Tab>First</Tab>
<Tab>Second</Tab>
Expand All @@ -67,7 +68,7 @@ export const Sizes = {
</TabList>
</>
<>
Medium
<Heading type="h3">Medium</Heading>
<TabList size="md">
<Tab>First</Tab>
<Tab>Second</Tab>
Expand All @@ -76,15 +77,15 @@ export const Sizes = {
</TabList>
</>
<>
Large
<Heading type="h3">Large</Heading>
<TabList size="lg">
<Tab>First</Tab>
<Tab>Second</Tab>
<Tab>Third</Tab>
<Tab disabled>Disabled</Tab>
</TabList>
</>
</div>
</Flex>
),

name: "Sizes"
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/components/Tabs/__stories__/Tabs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Tabs animation direction
{
positive: {
component: (
<DialogContentContainer className="monday-storybook-tabs_spacing">
<DialogContentContainer>
<TabList>
<Tab icon={Table}>Main Table</Tab>
<Tab icon={Chart}>Chart</Tab>
Expand All @@ -85,7 +85,7 @@ Tabs animation direction
},
negative: {
component: (
<DialogContentContainer className="monday-storybook-tabs_spacing">
<DialogContentContainer>
<TabList>
<Tab>Main Table</Tab>
<Tab icon={Gantt}> </Tab>
Expand All @@ -98,7 +98,7 @@ Tabs animation direction
{
positive: {
component: (
<DialogContentContainer className="monday-storybook-tabs_spacing">
<DialogContentContainer>
<TabList>
<Tab icon={NewTab}>Main Table</Tab>
<Tab icon={Table}>Table</Tab>
Expand All @@ -112,7 +112,7 @@ Tabs animation direction
},
negative: {
component: (
<DialogContentContainer className="monday-storybook-tabs_spacing">
<DialogContentContainer>
<TabList>
<Tab>Main...</Tab>
<Tab>Table</Tab>
Expand Down
26 changes: 0 additions & 26 deletions packages/core/src/components/Tabs/__stories__/Tabs.stories.scss

This file was deleted.

85 changes: 63 additions & 22 deletions packages/core/src/components/Tabs/__stories__/Tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ import TabPanels from "../TabPanels/TabPanels";
import TabsContext from "../TabsContext/TabsContext";
import { Calendar, Chart, Table } from "../../Icon/Icons";
import TextField from "../../TextField/TextField";
import "./Tabs.stories.scss";
import Box from "../../Box/Box";
import Flex from "../../Flex/Flex";

const ExampleTabContent = ({ children }: { children: string }) => (
<Box
backgroundColor={Box.backgroundColors.GREY_BACKGROUND_COLOR}
padding={Box.paddings.MEDIUM}
style={{ width: "480px", height: "111px" }}
>
{children}
</Box>
);

export default {
title: "Navigation/Tabs/Tabs",
Expand All @@ -19,18 +30,24 @@ export default {
}
};

const tabsTemplate = ({ tabPanelClassName, ...otherArgs }: { tabPanelClassName: string }) => {
const tabsTemplate = ({ ...args }) => {
return (
<TabsContext {...otherArgs}>
<TabsContext {...args}>
<TabList>
<Tab>First</Tab>
<Tab>Second</Tab>
<Tab>Third</Tab>
</TabList>
<TabPanels>
<TabPanel className={tabPanelClassName}>First slide</TabPanel>
<TabPanel className={tabPanelClassName}>Second slide</TabPanel>
<TabPanel className={tabPanelClassName}>Third slide</TabPanel>
<TabPanel>
<ExampleTabContent>First slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Second slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Third slide</ExampleTabContent>
</TabPanel>
</TabPanels>
</TabsContext>
);
Expand All @@ -55,10 +72,18 @@ export const Default = {
<Tab disabled>Disabled</Tab>
</TabList>
<TabPanels>
<TabPanel className="monday-storybook-tabs_bg-color">First slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Second slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Third slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Fourth slide</TabPanel>
<TabPanel>
<ExampleTabContent>First slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Second slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Third slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Fourth slide</ExampleTabContent>
</TabPanel>
</TabPanels>
</TabsContext>
),
Expand Down Expand Up @@ -87,7 +112,7 @@ export const Stretched = {

export const Motion = {
render: () => (
<div className="monday-storybook-tabs_column-wrapper">
<Flex direction="column" gap="medium">
<TabsContext>
<TabList>
<Tab>First</Tab>
Expand All @@ -96,10 +121,18 @@ export const Motion = {
<Tab disabled>Disabled</Tab>
</TabList>
<TabPanels animationDirection="ltr">
<TabPanel className="monday-storybook-tabs_bg-color">First slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Second slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Third slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Fourth slide</TabPanel>
<TabPanel>
<ExampleTabContent>First slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Second slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Third slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Fourth slide</ExampleTabContent>
</TabPanel>
</TabPanels>
</TabsContext>
<TabsContext>
Expand All @@ -110,13 +143,21 @@ export const Motion = {
<Tab disabled>Disabled</Tab>
</TabList>
<TabPanels animationDirection="rtl">
<TabPanel className="monday-storybook-tabs_bg-color">First slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Second slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Third slide</TabPanel>
<TabPanel className="monday-storybook-tabs_bg-color">Fourth slide</TabPanel>
<TabPanel>
<ExampleTabContent>First slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Second slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Third slide</ExampleTabContent>
</TabPanel>
<TabPanel>
<ExampleTabContent>Fourth slide</ExampleTabContent>
</TabPanel>
</TabPanels>
</TabsContext>
</div>
</Flex>
),

name: "Motion"
Expand All @@ -142,11 +183,11 @@ export const AdminSectionTabs = {
<Tab>Account</Tab>
</TabList>
<TabPanels>
<TabPanel className="monday-storybook-tabs_wrapper">
<TabPanel>
<h2>Login Details</h2>
<TextField title="Profile Name" size="medium" placeholder="Profile Name" />
</TabPanel>
<TabPanel className="monday-storybook-tabs_wrapper">
<TabPanel>
<h2>Account Details</h2>
<TextField title="Account Name" size="medium" placeholder="Account Name" />
</TabPanel>
Expand Down