Skip to content

Commit

Permalink
fix: migrate all basic ui components
Browse files Browse the repository at this point in the history
  • Loading branch information
useruseruse committed Sep 16, 2024
1 parent 3cb4ddd commit 311d23a
Show file tree
Hide file tree
Showing 39 changed files with 731 additions and 824 deletions.
61 changes: 0 additions & 61 deletions src/components/Attributes.jsx

This file was deleted.

62 changes: 62 additions & 0 deletions src/components/Attributes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React from 'react';
import { appBoundClassNames as classNames } from '../common/boundClassNames';
import { useTranslation } from 'react-i18next';

interface AttributeEntry {
name: string;
info: string | React.ReactNode;
onMouseOver?: () => void;
onMouseOut?: () => void;
onInfoClick?: () => void;
isInfoClickDisabled?: boolean;
}

interface AttributesProps {
entries: AttributeEntry[];
fixedWidthName?: boolean;
longName?: boolean;
longInfo?: boolean;
}

const Attributes = ({
entries,
fixedWidthName = false,
longName = false,
longInfo = false,
}: AttributesProps) => {
const { t } = useTranslation();

return (
<div>
{entries.map((e) => (
<div
className={classNames(
'attribute',
longName ? 'attribute--long-name' : '',
longInfo ? 'attribute--long-info' : '',
)}
onMouseOver={e.onMouseOver}
onMouseOut={e.onMouseOut}
key={e.name}>
<div className={classNames(fixedWidthName ? t('jsx.className.fixedByLang') : '')}>
{e.name}
</div>
{e.onInfoClick ? (
<div

Check warning on line 45 in src/components/Attributes.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Attributes.tsx#L45

Added line #L45 was not covered by tests
className={classNames(
'text-button',
e.isInfoClickDisabled ? 'text-button--disabled' : '',
)}
onClick={e.onInfoClick}>
{e.info}
</div>
) : (
<div>{e.info}</div>
)}
</div>
))}
</div>
);
};

export default Attributes;
63 changes: 0 additions & 63 deletions src/components/BetaPopup.jsx

This file was deleted.

47 changes: 47 additions & 0 deletions src/components/BetaPopup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { useState } from 'react';
import { appBoundClassNames as classNames } from '../common/boundClassNames';

Check warning on line 2 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L1-L2

Added lines #L1 - L2 were not covered by tests

import CloseButton from './CloseButton';

Check warning on line 4 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L4

Added line #L4 was not covered by tests

interface BetaPopupProps {
title: string;
content: string[];
link: string;
}

const BetaPopup = ({ title, content, link }: BetaPopupProps) => {
const [isOpen, setIsOpen] = useState(true);

Check warning on line 13 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L12-L13

Added lines #L12 - L13 were not covered by tests

const close = () => {
setIsOpen(false);

Check warning on line 16 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L15-L16

Added lines #L15 - L16 were not covered by tests
};

if (!isOpen) {
return null;

Check warning on line 20 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L20

Added line #L20 was not covered by tests
}

return (

Check warning on line 23 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L23

Added line #L23 was not covered by tests
<div className={classNames('section', 'section--popup')}>
<CloseButton onClick={close} />
<div className={classNames('subsection', 'subsection--flex', 'subsection--beta-popup')}>
<div className={classNames('title')}>{title}</div>
<div className={classNames('subsection--beta-popup__content')}>
{content.map((l, index) => (
<div key={index}>{l}</div>

Check warning on line 30 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L30

Added line #L30 was not covered by tests
))}
</div>
<div className={classNames('buttons')}>
<a
href={link}
className={classNames('text-button')}
target="_blank"
rel="noopener noreferrer">
피드백 제출하기
</a>
</div>
</div>
</div>
);
};

export default BetaPopup;

Check warning on line 47 in src/components/BetaPopup.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/BetaPopup.tsx#L47

Added line #L47 was not covered by tests
24 changes: 0 additions & 24 deletions src/components/CloseButton.jsx

This file was deleted.

18 changes: 18 additions & 0 deletions src/components/CloseButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { appBoundClassNames as classNames } from '../common/boundClassNames';

Check warning on line 2 in src/components/CloseButton.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CloseButton.tsx#L2

Added line #L2 was not covered by tests

interface CloseButtonProps {
onClick: () => void;
}

const CloseButton = ({ onClick }: CloseButtonProps) => {
return (

Check warning on line 9 in src/components/CloseButton.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CloseButton.tsx#L8-L9

Added lines #L8 - L9 were not covered by tests
<div className={classNames('close-button-wrap')}>
<button onClick={onClick}>
<i className={classNames('icon', 'icon--close-section')} />
</button>
</div>
);
};

export default CloseButton;

Check warning on line 18 in src/components/CloseButton.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CloseButton.tsx#L18

Added line #L18 was not covered by tests
38 changes: 0 additions & 38 deletions src/components/CountController.jsx

This file was deleted.

31 changes: 31 additions & 0 deletions src/components/CountController.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import { appBoundClassNames as classNames } from '../common/boundClassNames';

Check warning on line 2 in src/components/CountController.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CountController.tsx#L2

Added line #L2 was not covered by tests

interface CountControllerProps {
count: number;
updateCount: (newCount: number) => void;
}

const CountController: React.FC<CountControllerProps> = ({ count, updateCount }) => {
return (

Check warning on line 10 in src/components/CountController.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CountController.tsx#L9-L10

Added lines #L9 - L10 were not covered by tests
<div className={classNames('course-status--info--controller')}>
<i
className={classNames('icon', 'icon--planner-minus')}
onClick={() => {

Check warning on line 14 in src/components/CountController.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CountController.tsx#L14

Added line #L14 was not covered by tests
if (count > 0) {
updateCount(count - 1);

Check warning on line 16 in src/components/CountController.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CountController.tsx#L16

Added line #L16 was not covered by tests
}
}}
/>
<div>{count}</div>
<i
className={classNames('icon', 'icon--planner-plus')}
onClick={() => {
updateCount(count + 1);

Check warning on line 24 in src/components/CountController.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CountController.tsx#L23-L24

Added lines #L23 - L24 were not covered by tests
}}
/>
</div>
);
};

export default CountController;

Check warning on line 31 in src/components/CountController.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/CountController.tsx#L31

Added line #L31 was not covered by tests
Loading

0 comments on commit 311d23a

Please sign in to comment.