Skip to content

Commit

Permalink
Merge pull request #14 from ahmetarsiv/master
Browse files Browse the repository at this point in the history
Some bug fixed
  • Loading branch information
ahmetarsiv authored Mar 9, 2024
2 parents ca828f6 + a59702a commit 2d7cc6d
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 115 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codenteq/interfeys",
"version": "0.3.2",
"version": "0.3.3",
"description": "Codenteq Interfeys Design System",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 0 additions & 2 deletions src/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';

interface IAvatarProps {
Expand Down
2 changes: 0 additions & 2 deletions src/badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';

interface IBadgeProps {
Expand Down
2 changes: 0 additions & 2 deletions src/button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';

type IButtonType = 'button' | 'submit' | 'reset';
Expand Down
2 changes: 0 additions & 2 deletions src/card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { ReactNode, useState } from 'react';

interface ICardProps {
Expand Down
2 changes: 0 additions & 2 deletions src/info-card/InfoCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';

interface IInfoCardProps {
Expand Down
48 changes: 29 additions & 19 deletions src/input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use client';

import React, { ChangeEvent, InputHTMLAttributes } from 'react';
import React, {
ChangeEvent,
forwardRef,
InputHTMLAttributes,
Ref,
} from 'react';

type InputType =
| 'text'
Expand Down Expand Up @@ -32,22 +35,26 @@ interface IInputProps extends InputHTMLAttributes<HTMLInputElement> {
messages?: string | string[];
}

export default function Input({
className,
type,
value,
onChange,
placeholder,
autoFocus,
required,
disabled,
helpText,
messages = [],
...props
}: IInputProps) {
return (
const Input = forwardRef(
(
{
className,
type,
value,
onChange,
placeholder,
autoFocus,
required,
disabled,
helpText,
messages = [],
...props
}: IInputProps,
ref: Ref<HTMLInputElement>,
) => (
<div>
<input
ref={ref}
type={type}
value={value}
onChange={onChange}
Expand Down Expand Up @@ -75,5 +82,8 @@ export default function Input({
<p className="text-sm text-red-600">{messages}</p>
)}
</div>
);
}
),
);
Input.displayName = 'Input';

export default Input;
2 changes: 0 additions & 2 deletions src/label/Label.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';

interface ILabelProps extends React.HTMLProps<HTMLLabelElement> {
Expand Down
2 changes: 0 additions & 2 deletions src/modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { useState, useEffect } from 'react';
import { motion, AnimatePresence } from 'framer-motion';

Expand Down
48 changes: 30 additions & 18 deletions src/radio/Radio.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use client';

import React, { ChangeEvent, InputHTMLAttributes } from 'react';
import React, {
ChangeEvent,
forwardRef,
InputHTMLAttributes,
Ref,
} from 'react';

type InputType = 'radio';

Expand All @@ -11,22 +14,26 @@ interface IRadioProps extends InputHTMLAttributes<HTMLInputElement> {
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
required?: boolean;
disabled?: boolean;
messages?: string[];
messages?: string | string[];
}

export default function Radio({
className,
type,
value,
onChange,
required,
disabled,
messages = [],
...props
}: IRadioProps) {
return (
const Radio = forwardRef(
(
{
className,
type,
value,
onChange,
required,
disabled,
messages = [],
...props
}: IRadioProps,
ref: Ref<HTMLInputElement>,
) => (
<div>
<input
ref={ref}
type={type}
value={value}
onChange={onChange}
Expand All @@ -35,15 +42,20 @@ export default function Radio({
disabled={disabled}
{...props}
/>
{messages.length > 0 && (
{messages.length > 0 && Array.isArray(messages) ? (
<>
{messages.map((message, index) => (
<p className="text-sm text-red-600" key={index}>
{message}
</p>
))}
</>
) : (
<p className="text-sm text-red-600">{messages}</p>
)}
</div>
);
}
),
);
Radio.displayName = 'Radio';

export default Radio;
37 changes: 21 additions & 16 deletions src/select/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
'use client';

import React, { SelectHTMLAttributes } from 'react';
import React, { forwardRef, Ref, SelectHTMLAttributes } from 'react';

interface SelectOption {
label: string;
Expand All @@ -17,19 +15,23 @@ interface ISelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
messages?: string | string[];
}

export default function Select({
options,
value,
placeholder,
className,
required,
disabled,
messages = [],
...props
}: ISelectProps) {
return (
const Select = forwardRef(
(
{
options,
value,
placeholder,
className,
required,
disabled,
messages = [],
...props
}: ISelectProps,
ref: Ref<HTMLSelectElement>,
) => (
<div>
<select
ref={ref}
value={value}
className={`${className} w-full text-sm transition placeholder-transition hover:border-zinc-900 dark:hover:border-zinc-300 hover:placeholder-text-zinc-900 dark:hover:placeholder-text-zinc-300 focus:ring-transparent focus:border-zinc-900 dark:focus:border-zinc-300 bg-white dark:bg-black text-zinc-900 dark:text-zinc-300 focus:placeholder-text-zinc-900 dark:focus:placeholder-text-zinc-300 rounded-lg p-3`}
disabled={disabled}
Expand Down Expand Up @@ -58,5 +60,8 @@ export default function Select({
<p className="text-sm text-red-600">{messages}</p>
)}
</div>
);
}
),
);
Select.displayName = 'Select';

export default Select;
11 changes: 8 additions & 3 deletions src/slider/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';
import 'swiper/css';
import { Swiper, SwiperSlide } from 'swiper/react';
Expand All @@ -13,7 +11,14 @@ interface ISliderProps {
spaceBetween?: number;
}

export default function Slider({ images, width, height, className, slidesPerView = 1, spaceBetween = 20 }: ISliderProps) {
export default function Slider({
images,
width,
height,
className,
slidesPerView = 1,
spaceBetween = 20,
}: ISliderProps) {
return (
<Swiper
className={className}
Expand Down
48 changes: 30 additions & 18 deletions src/switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use client';

import React, { ChangeEvent, InputHTMLAttributes } from 'react';
import React, {
ChangeEvent,
forwardRef,
InputHTMLAttributes,
Ref,
} from 'react';

type InputType = 'checkbox';

Expand All @@ -11,23 +14,27 @@ interface ISwitchProps extends InputHTMLAttributes<HTMLInputElement> {
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
required?: boolean;
disabled?: boolean;
messages?: string[];
messages?: string | string[];
}

export default function Switch({
className,
type,
value,
onChange,
required,
disabled,
messages = [],
...props
}: ISwitchProps) {
return (
const Switch = forwardRef(
(
{
className,
type,
value,
onChange,
required,
disabled,
messages = [],
...props
}: ISwitchProps,
ref: Ref<HTMLInputElement>,
) => (
<div>
<label className="relative inline-flex items-center mr-5 cursor-pointer">
<input
ref={ref}
type={type}
value={value}
onChange={onChange}
Expand All @@ -38,15 +45,20 @@ export default function Switch({
/>
<div className="w-11 h-6 bg-zinc-300 rounded-full peer dark:bg-zinc-900 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:left-[2px] after:bg-white after:border-zinc-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-zinc-600 peer-checked:bg-brand" />
</label>
{messages.length > 0 && (
{messages.length > 0 && Array.isArray(messages) ? (
<>
{messages.map((message, index) => (
<p className="text-sm text-red-600" key={index}>
{message}
</p>
))}
</>
) : (
<p className="text-sm text-red-600">{messages}</p>
)}
</div>
);
}
),
);
Switch.displayName = 'Switch';

export default Switch;
2 changes: 0 additions & 2 deletions src/tab-group/Tab.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { ReactNode, useState } from 'react';

interface ITabProps {
Expand Down
2 changes: 0 additions & 2 deletions src/table/Datatable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { ChangeEvent, ReactNode } from 'react';
import Input from '../input/Input';
import { useTable, usePagination, Column } from 'react-table';
Expand Down
2 changes: 0 additions & 2 deletions src/table/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React, { ReactNode } from 'react';
import { IBasePaginate } from './IPaginate';

Expand Down
Loading

0 comments on commit 2d7cc6d

Please sign in to comment.