Skip to content
Open
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
12 changes: 12 additions & 0 deletions contributionsguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ We've provided a more extensive resource on building the best commit messages -

<br/>

### Folder Structures for import ###
Folder structure for new components & how imports should work with setup
```
/src/packages/[Component]/src
\- index.tsx
\- Readme

/src/packages/[Component]/src/[Sub-Component]/

import { Component, SubComponent, SubComponentTwo } from '@sexui/component';
```

#### **Contributions Credit**

Every approved contributor appears on the insights of the project and is allowed to use SexyUI for a portfolio or resume reference.
Expand Down
46 changes: 46 additions & 0 deletions src/packages/Input/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# @sexy-ui/Input

A custom input component

The `Input` is a component that is used to get user input in a text field.

## Installation

```sh
yarn add @sexy-ui/Input

# or

npm i @sexy-ui/Input
```

## Import components

```jsx
import { Input } from "@sexy-ui/react";
```

## Usage

```jsx
<Input type="text" sizeVariant="large" />
```

### Input Style variants and color schemes

Input can be displayed with a few different variants for styling!

```jsx
...
<Input type="date" sizeVariant="medium" />
...
```

### Input sizes

You can change the size of the sliders by passing `sizeVariant` prop. We support 3 sizes
`small`, `medium`, `large`

### Input types

We support all basic input types
4 changes: 2 additions & 2 deletions src/packages/Input/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { Input } from "./Input";
export type { InputProps } from "./Input.props";
export { Input } from "./src/Input/Input";
export type { InputProps } from "./src/Input/Input.props";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SizeType } from "../../utils/types.util";
import { SizeType } from "../../../../utils/types.util";

export interface InputProps
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from "styled-components";
import { setFontSize } from "../../../../utils/styles.util";
import { darkTheme } from "../../../../utils/theme.util";
import { InputProps } from "./Input.props";
import { darkTheme } from "../../utils/theme.util";
import { setFontSize } from "../../utils/styles.util";

export const StyledInput = styled.input<InputProps>`
${(props: InputProps) => setFontSize(props.sizeVariant)}
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions src/packages/tabs/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

// @ts-ignore

export * from "./src";
export { Tab } from "./src/Tab/Tab";
export { Tabs } from "./src/Tabs/Tabs";
export { TabList } from "./src/TabList/TabList";
export { TabPanels } from "./src/TabPanels/TabPanels";
export { TabContent } from "./src/TabContent/TabContent";
13 changes: 13 additions & 0 deletions src/packages/tabs/src/Tab/Tab.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from "styled-components";

export const StyledTab = styled.div`
display: flex;
flex-direction: column;
border: 1px solid blue;
height: 5vh;
width: 10vw;
border-radius: 20px;
background-color: blanchedalmond;
text-align: center;
font-size: 1rem;
`;
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import { useContext } from "react";
import styled from "styled-components";
import { MyStore } from "../context/myStore";
import { MyStore } from "../../context/myStore";
import { useEffect } from "react";

export const TabMain = styled.div`
display: flex;
flex-direction: column;
border: 1px solid blue;
height: 5vh;
width: 10vw;
border-radius: 20px;
background-color: blanchedalmond;
text-align: center;
font-size: 1rem;
`;
import { StyledTab } from "./Tab.styled";

/*
The Tab component accepts two elements into the 'children' array
Expand All @@ -39,8 +27,8 @@ export const Tab: any = ({ children }: any) => {
};

return (
<TabMain aria-label="inactive" onClick={handleContentSetting}>
<StyledTab aria-label="inactive" onClick={handleContentSetting}>
{children[0]}
</TabMain>
</StyledTab>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useContext, useEffect } from "react";
import { MyStore } from "../context/myStore";
import { useStore } from "../context/useStore";
import { MyStore } from "../../context/myStore";

/*
This component displays content received from the context store
Expand Down
8 changes: 8 additions & 0 deletions src/packages/tabs/src/TabList/TabList.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from "styled-components";

export const StyledTabList = styled.div`
display: flex;
width: 100%;
height: 30%;
gap: 70px;
`;
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import styled from "styled-components";
import { useEffect, useContext } from "react";
import { useStore, Store } from "../context/useStore";
import { MyStore } from "../context/myStore";
import { useStore, Store } from "../../context/useStore";
import { MyStore } from "../../context/myStore";
import { StyledTabList } from "./TabList.styled";

// Wrapper for tab components inside Tabs**

const ListedTabs = styled.div`
display: flex;
width: 100%;
height: 30%;
gap: 70px;
`;

/*
We use this component to set the default starting value of the `TabContent` component
to be the content in the first instance
Expand All @@ -29,5 +22,5 @@ export const TabList: any = ({ children }: any) => {
myStore.setContent(children[store.selectedTab].props.children[1].props);
}, []);

return <ListedTabs>{children}</ListedTabs>;
return <StyledTabList>{children}</StyledTabList>;
};
17 changes: 0 additions & 17 deletions src/packages/tabs/src/TabPanels.tsx

This file was deleted.

6 changes: 6 additions & 0 deletions src/packages/tabs/src/TabPanels/TabPanels.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import styled from "styled-components";

export const StyledTabPanels = styled.div`
display: flex;
flex-direction: row;
`;
6 changes: 6 additions & 0 deletions src/packages/tabs/src/TabPanels/TabPanels.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";
import { StyledTabPanels } from "./TabPanels.styled";

export const TabPanels: any = ({ children }: any) => {
return <StyledTabPanels>{children}</StyledTabPanels>;
};
28 changes: 0 additions & 28 deletions src/packages/tabs/src/Tabs.tsx

This file was deleted.

3 changes: 3 additions & 0 deletions src/packages/tabs/src/Tabs/Tabs.props.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface TabsProps {
children?: any;
}
52 changes: 52 additions & 0 deletions src/packages/tabs/src/Tabs/Tabs.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from "react";
import { ComponentStory, ComponentMeta } from "@storybook/react";
import { Tabs } from "./Tabs";
import { TabList } from "../TabList/TabList";
import { TitleWrapper } from "../wrappers/TitleWrapper";
import { Tab } from "../Tab/Tab";
import { ContentWrapper } from "../wrappers/ContentWrapper";
import { TabPanels } from "../TabPanels/TabPanels";
import { TabContent } from "../TabContent/TabContent";

export default {
title: "Tabs",
component: Tabs,
parameters: {
docs: {
description: {
component: "Tabs Component",
},
},
},
} as ComponentMeta<typeof Tabs>;

const Template: ComponentStory<typeof Tabs> = (args) => (
<Tabs>
<TabList>
<Tab>
<TitleWrapper>One </TitleWrapper>
<ContentWrapper>
<p>Welcome to Tab 1</p>
</ContentWrapper>
</Tab>
<Tab>
<TitleWrapper>Two </TitleWrapper>
<ContentWrapper>
<p>Welcome to Tab 2</p>
</ContentWrapper>
</Tab>
<Tab>
<TitleWrapper>Three </TitleWrapper>
<ContentWrapper>
<p>Welcome to Tab 3</p>
</ContentWrapper>
</Tab>
</TabList>

<TabPanels>
<TabContent />
</TabPanels>
</Tabs>
);

export const ExampleTab = Template.bind({});
8 changes: 8 additions & 0 deletions src/packages/tabs/src/Tabs/Tabs.styled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import styled from "styled-components";

export const StyledTabs = styled.div`
display: flex;
flex-direction: column;
gap: 30px;
height: 50vh;
`;
18 changes: 18 additions & 0 deletions src/packages/tabs/src/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { MyStore } from "../../context/myStore";
import { useStore } from "../../context/useStore";
import { TabsProps } from "./Tabs.props";
import { StyledTabs } from "./Tabs.styled";

/* Tabs is wrapper component that holds list of tab topics and
contents for each tab in a different wrapper
*/

export const Tabs = ({ children }: TabsProps) => {
const myStore = useStore();
return (
// Store provider for hydrating tab content
<MyStore.Provider value={myStore}>
<StyledTabs>{children}</StyledTabs>;
</MyStore.Provider>
);
};
10 changes: 5 additions & 5 deletions src/packages/tabs/src/UseCaseTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Tabs } from "./Tabs";
import { TabList } from "./TabList";
import { Tab } from "./Tab";
import { TabPanels } from "./TabPanels";
import { TabContent } from "./TabContent";
import { Tabs } from "./Tabs/Tabs";
import { TabList } from "./TabList/TabList";
import { Tab } from "./Tab/Tab";
import { TabPanels } from "./TabPanels/TabPanels";
import { TabContent } from "./TabContent/TabContent";
import { TitleWrapper } from "./wrappers/TitleWrapper";
import { ContentWrapper } from "./wrappers/ContentWrapper";

Expand Down
1 change: 0 additions & 1 deletion src/packages/tabs/stories/tab.stories.tsx

This file was deleted.