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

Implement TabViewer component #24

Merged
merged 9 commits into from
Jul 14, 2023
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Versions

- [2.1.0](#210)
- [2.0.0](#200)
- [1.2.0](#120)
- [1.1.0](#110)
Expand All @@ -15,6 +16,13 @@

<br>

### 2.1.0

- `TabViewer` component
- Minor fixes

<br>

### 2.0.0

- `Calendar` component
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobrix-ui",
"version": "2.0.3",
"version": "2.1.0",
"description": "React components for every app, easy to use and customize",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
Expand Down
1 change: 1 addition & 0 deletions playground/public/locales/de/tabviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions playground/public/locales/en/tabviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions playground/public/locales/es/tabviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions playground/public/locales/fr/tabviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions playground/public/locales/it/tabviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions playground/src/components/AppPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import classNames from "classnames";
import { AllowedComponent, Container } from "mobrix-ui-preview";
import { BuilderComponent, Container } from "mobrix-ui-preview";

const AppPage = ({
className,
children,
}: {
className?: string;
children: AllowedComponent | AllowedComponent[];
children: BuilderComponent | BuilderComponent[];
}) => {
return (
<Container animated unstyled className={classNames("m-2", className)}>
Expand Down
6 changes: 3 additions & 3 deletions playground/src/components/ComponentPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TFunction, useTranslation } from "react-i18next";

import { useCommonTranslation } from "hooks/localization";

import { AllowedComponent, Table } from "mobrix-ui-preview";
import { BuilderComponent, Table } from "mobrix-ui-preview";
import AppLabel from "../AppLabel";
import AppPage from "../AppPage";

Expand All @@ -13,11 +13,11 @@ export const ComponentPage = ({
props,
translations,
}: {
children?: AllowedComponent | AllowedComponent[];
children?: BuilderComponent | BuilderComponent[];
render?: (
t: TFunction,
label?: string
) => AllowedComponent | AllowedComponent[];
) => BuilderComponent | BuilderComponent[];
name: string;
props?: string[][];
translations?: boolean;
Expand Down
1 change: 1 addition & 0 deletions playground/src/engine.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const engineConfig = {
Slider: "/components/atoms/Slider",
Spinner: "/components/atoms/Spinner",
Table: "/components/molecules/Table",
TabViewer: "/components/organisms/TabViewer",
Toggle: "/components/atoms/Toggle",
},
},
Expand Down
2 changes: 1 addition & 1 deletion playground/src/pages/FacebookButtons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { ComponentPage } from "components/ComponentPage";
import { demoRows, demoProps } from "constants/demo-props";
import DemoComponent from "components/DemoComponent";
import { FacebookButtonsProps } from "mobrix-ui-preview/components/atoms/FacebookButtons/types";
import { FacebookButtonsProps } from "mobrix-ui-preview";

const FacebookButtonsPage = () => (
<ComponentPage
Expand Down
77 changes: 77 additions & 0 deletions playground/src/pages/TabViewer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { Card, Form, TabViewer } from "mobrix-ui-preview";
import {
HiddenProp,
NumberProp,
StringProp,
} from "@cianciarusocataldo/demo-ui";
import { ComponentPage } from "components/ComponentPage";
import { demoRows, demoProps } from "constants/demo-props";
import DemoComponent from "components/DemoComponent";

const TabViewerPage = () => (
<ComponentPage
name="TabViewer"
translations
render={(t, componentLabel) => {
return (
<DemoComponent
label={componentLabel}
startColor="#BFBABA"
props={{
tabClassName: StringProp(""),
tabSelectedClassName: StringProp(""),
tabUnselectedClassName: StringProp(""),
tabViewClassName: StringProp(""),
selected: NumberProp(0),
tabs: HiddenProp([
{
label: "Tab 1",
content: (
<div className="bg-white p-4">
<Card
shadow
header={"Example card"}
body={`Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
`}
/>
</div>
),
},
{
label: "Tab 2",
content: (
<div>
<Form
shadow
fields={{
field_1: { header: "Example field", type: "boolean" },
}}
buttonContent={"Submit"}
/>
</div>
),
},
{
label: "Tab 3",
content: <div>Tab 3 content</div>,
},
]),
...demoProps,
}}
rows={[
["selected", "tabClassName", "tabSelectedClassName"],
["tabUnselectedClassName", "tabViewClassName"],
...demoRows,
]}
>
{TabViewer}
</DemoComponent>
);
}}
/>
);

export default TabViewerPage;
2 changes: 1 addition & 1 deletion src/components/atoms/Button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { buildMobrixUiStandardComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Button: ButtonComponent = ({
disabled,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/CheckBox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { DefaultCheckIcon } from "./icons";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Checkbox: CheckBoxComponent = ({
value,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/CodeBox/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import codeboxComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const CodeBox: CodeBoxComponent = ({
value,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/CodeBox/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
export const CODE_LANGUAGES = {
common: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/CodeBox/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const getHighlightedCode = (
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
export const parseCode = (code: string, environment: SupportedEnvironment) => {
return getHighlightedCode(
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Counter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { buildMobrixUiReactiveComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Counter: CounterComponent = ({
onChange,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Divider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { buildMobrixUiStandardComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Divider: DividerComponent = (props) =>
buildMobrixUiStandardComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/FacebookButtons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import facebookButtonsComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const FacebookButtons: FacebookButtonsComponent = ({
pageId,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Input/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { buildMobrixUiReactiveComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Input: InputComponent = ({
onChange,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Label/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { buildMobrixUiStandardComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Label: LabelComponent = ({ children, ...commonProps }) =>
buildMobrixUiStandardComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Link/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { buildMobrixUiStandardComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Link: LinkComponent = ({ to, children, newTab, ...commonProps }) =>
buildMobrixUiStandardComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/RadioButton/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import component from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const RadioButton: RadioButtonComponent = ({
value: inputValue,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Selector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import selectorComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Selector: SelectorComponent = ({
elements,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Slider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { buildMobrixUiReactiveComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Slider: SliderComponent = ({
onChange = () => {},
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Spinner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import defaultIcons from "./icons";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Spinner: SpinnerComponent = ({
value: inputValue,
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Toggle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import toggleComponentBuilder from "./builder";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Toggle: ToggleComponent = ({ value: inputValue, ...props }) =>
buildMobrixUiReactiveComponent<boolean>({
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/Card/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import cardComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Card: CardComponent = ({
icon,
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/Carousel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import carouselComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Carousel: CarouselComponent = ({
elements: actualElements,
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/Container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { buildMobrixUiStandardComponent } from "../../../utils";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Container: ContainerComponent = ({
children,
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/Dropdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import dropdownComponentBuilder from "./builder";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Dropdown: DropdownComponent = ({
content,
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/ExpandableContainer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import expandableContainerComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const ExpandableContainer: ExpandableContainerComponent = ({
expanded,
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/Form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import formComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const Form: FormComponent = ({
title,
Expand Down
2 changes: 1 addition & 1 deletion src/components/molecules/List/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import listComponent from "./component";
*
* @author Cataldo Cianciaruso <https://github.com/CianciarusoCataldo>
*
* @copyright 2022 Cataldo Cianciaruso
* @copyright 2023 Cataldo Cianciaruso
*/
const List: ListComponent = ({ elements, onChange, ...commonProps }) =>
buildMobrixUiStandardComponent({
Expand Down
Loading
Loading