Skip to content

Commit

Permalink
Merge branch 'main' into fix-58-2
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli committed Aug 16, 2024
2 parents 2113b11 + ba8be13 commit 30f18b8
Show file tree
Hide file tree
Showing 14 changed files with 474 additions and 77 deletions.
6 changes: 0 additions & 6 deletions .changeset/fluffy-mirrors-kiss.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/spicy-teachers-admire.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/swift-toys-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"docs": patch
---

scripts 추가함.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# es-hangul

## 2.1.0

### Minor Changes

- [#228](https://github.com/toss/es-hangul/pull/228) [`0633b9f`](https://github.com/toss/es-hangul/commit/0633b9f04991ff432004a8ae1ecfbf6bc5682d70) Thanks [@BO-LIKE-CHICKEN](https://github.com/BO-LIKE-CHICKEN)! - feat: 숫자를 날짜를 나타내는 순우리말로 바꿔주는 함수 중 days를 추가

## 2.0.0

### Major Changes
Expand Down
50 changes: 26 additions & 24 deletions docs/src/components/Sandpack/Sandpack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,35 @@ import { SandpackProps, SandpackProvider } from '@codesandbox/sandpack-react';
import { atomDark } from '@codesandbox/sandpack-themes';
import { baseTemplate } from './baseTemplate';
import { CustomPreset } from './CustomPreset';
import { useIsDarkMode } from '@/hooks/use-is-dark-mode';
import { SandpackLogLevel } from '@codesandbox/sandpack-client';
import { ThemeMode } from '../theme-mode/ThemeMode';

export function Sandpack({ files }: SandpackProps) {
const isDarkMode = useIsDarkMode();

return (
<SandpackProvider
template="vanilla-ts"
theme={isDarkMode ? atomDark : undefined}
files={{
...baseTemplate.files,
...files,
}}
customSetup={{
dependencies: baseTemplate.dependencies,
devDependencies: baseTemplate.devDependencies,
}}
options={{
recompileDelay: 300,
initMode: 'user-visible',
initModeObserverOptions: { rootMargin: '1400px 0px' },
bundlerURL: 'https://sandpack-bundler.codesandbox.io/',
logLevel: SandpackLogLevel.None,
}}
>
<CustomPreset />
</SandpackProvider>
<ThemeMode>
{theme => (
<SandpackProvider
template="vanilla-ts"
theme={theme === 'dark' ? atomDark : undefined}
files={{
...baseTemplate.files,
...files,
}}
customSetup={{
dependencies: baseTemplate.dependencies,
devDependencies: baseTemplate.devDependencies,
}}
options={{
recompileDelay: 300,
initMode: 'user-visible',
initModeObserverOptions: { rootMargin: '1400px 0px' },
bundlerURL: 'https://sandpack-bundler.codesandbox.io/',
logLevel: SandpackLogLevel.None,
}}
>
<CustomPreset />
</SandpackProvider>
)}
</ThemeMode>
);
}
14 changes: 10 additions & 4 deletions docs/src/components/introduction/Adopters.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useIsDarkMode } from '@/hooks/use-is-dark-mode';
import Image from 'next/image';
import { ComponentProps } from 'react';
import { ThemeMode } from '../theme-mode/ThemeMode';

/**
* 이 곳에 적용한 조직을 추가해주세요.
Expand Down Expand Up @@ -28,12 +28,18 @@ export const adopterLogoImagePropsList = [
>;

export const Adopters = () => {
const isDarkMode = useIsDarkMode();

return (
<div className="flex flex-wrap gap-8 justify-center">
{adopterLogoImagePropsList.map(({ darkSrc, src, alt, ...props }) => (
<Image key={src} src={isDarkMode ? darkSrc : src} alt={alt} {...props} />
<ThemeMode key={src}>
{(theme) => (
<Image
src={theme === 'dark' ? darkSrc : src}
alt={alt}
{...props}
/>
)}
</ThemeMode>
))}
</div>
);
Expand Down
17 changes: 17 additions & 0 deletions docs/src/components/theme-mode/ThemeMode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { useIsDarkMode } from '@/hooks/use-is-dark-mode';

interface ThemeModeProps {
children: (theme: 'dark' | 'light') => React.ReactNode;
fallback?: React.ReactNode;
}

export function ThemeMode({ children, fallback = null }: ThemeModeProps) {
const isDarkMode = useIsDarkMode();

if (isDarkMode == null) {
return fallback;
}

return children(isDarkMode ? 'dark' : 'light');
}
2 changes: 1 addition & 1 deletion docs/src/hooks/use-is-dark-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';

export function useIsDarkMode() {
const { resolvedTheme } = useTheme();
const [isDarkMode, setIsDarkMode] = useState(false);
const [isDarkMode, setIsDarkMode] = useState<boolean>();

useEffect(() => {
setIsDarkMode(resolvedTheme === 'dark');
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/docs/api/date.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { Sandpack } from '@/components/Sandpack';

# date

Convert numbers to native Korean words representing dates. The given number is valid when it is greater than 0 and less than or equal to 30.
Convert numbers to native Korean words representing dates.

## days

Convert numbers to native Korean words for days.
Convert numbers to native Korean words for days. The given number is valid when it is greater than 0 and less than or equal to 30.

```typescript
function days(
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/docs/api/date.ko.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { Sandpack } from '@/components/Sandpack';

# date

숫자를 날짜를 나타내는 순우리말로 바꿔줍니다. 주어진 숫자가 0보다 크고 30 이하일 때 유효합니다.
숫자를 날짜를 나타내는 순우리말로 바꿔줍니다.

## days

숫자를 순우리말 날로 바꿔줍니다.
숫자를 순우리말 날로 바꿔줍니다. 주어진 숫자가 0보다 크고 30 이하일 때 유효합니다.

```typescript
function days(
Expand Down
187 changes: 187 additions & 0 deletions docs/src/pages/docs/migration/v2.en.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: Migrating to v2
---

# Migrating to v2

## New Features

### The `hasBatchim` function now has additional options.

The `hasBatchim` function has been updated with an `only` option, allowing you to check if a string has a single batchim, double batchim, or any batchim at all.

```tsx
// Check if there is only a single batchim
hasBatchim('', { only: 'single' });

// Check if there is only a double batchim
hasBatchim('', { only: 'double' });

// Check if there is a batchim
hasBatchim('');

## Handling BREAKING CHANGES

### The acronymizeHangul function has been removed.

This function was removed as it was not closely related to Hangul domain needs.
If you need to extract initials, you can use the following method:

```tsx
string.split(' ').map(word => word.charAt(0));
```

### The assembleHangul function has been renamed.


As specified in the [CONTRIBUTING.md](https://github.com/toss/es-hangul/blob/main/.github/CONTRIBUTING.md), the hangul suffix has been removed from the function name.

```tsx
// ASIS
assembleHangul('ㄱ', 'ㅏ', 'ㅁ')
// TOBE
assemble('ㄱ', 'ㅏ', 'ㅁ')
```

### The choseongIncludes and chosungIncludes functions have been removed.

The process of extracting the initial consonants (choseong) is provided by es-hangul, and checking for inclusion can be done with basic JavaScript methods, so these functions have been removed. You can use the getChoseong function to extract choseong, then use the includes method.


```tsx
// ASIS
chosungIncludes('바나나', 'ㅂㄴㄴ');
choseongIncludes('바나나', 'ㅂㄴㄴ');

// TOBE

const choseonged = getChoseing('바나나');
chosunged.includes('ㅂㄴㄴ');
```
### The curriedCombineHangulCharacter function has been removed.
The curriedCombineHangulCharacter function was removed as it was not intended for direct user use.
If needed, you can implement it as follows:
```tsx

export const curriedCombineHangulCharacter=
(firstCharacter: string) =>
(middleCharacter: string) =>
(lastCharacter = '') =>
combineCharacter(firstCharacter, middleCharacter, lastCharacter);
```
### The combineHangulCharacter function has been renamed.
As specified in the [CONTRIBUTING.md](https://github.com/toss/es-hangul/blob/main/.github/CONTRIBUTING.md), the hangul suffix has been removed from the function name.
```tsx
// ASIS
combineHangulCharacter('', '', '')

// TOBE
combineCharacter('', '', '')
```
### The convertQwertyToHangulAlphabet function has been renamed.
As specified in the [CONTRIBUTING.md](https://github.com/toss/es-hangul/blob/main/.github/CONTRIBUTING.md), the hangul suffix has been removed from the function name.
```tsx
// ASIS
convertQwertyToHangulAlphabet('r')

// TOBE
convertQwertyToAlphabet('r')
```
### The disassembleHangul, disassembleHangulToGroups, and disassembleCompleteHangulCharacter functions have been renamed.
As specified in the [CONTRIBUTING.md](https://github.com/toss/es-hangul/blob/main/.github/CONTRIBUTING.md), the hangul suffix has been removed from the function name.
```tsx
// ASIS
disassembleHangul('');
disassembleHangulToGroups('');
disassembleCompleteHangulCharacter('');

// TOBE
disassemble('');
disassembleToGroups('');
disassembleCompleteCharacter('');
```
### The `extractHangul` function has been removed.
It was removed as it is not closely related to the Hangul domain.<br/>
### The `hangulIncludes` function has been removed.
It was removed as it is not closely related to the Hangul domain.<br/>
If needed, you can use the following method:
```tsx
function hangulIncludes(x: string, y: string) {
const disassembledX = disassembleHangul(x);
const disassembledY = disassembleHangul(y);

return disassembledX.includes(disassembledY);
}

### The function name removeLastHangulCharacter has been changed.

As specified in the [CONTRIBUTING.md](https://github.com/toss/es-hangul/blob/main/.github/CONTRIBUTING.md), the hangul suffix has been removed from the function name.


```tsx
// ASIS
removeLastHangulCharacter('감');
// TOBE
removeLastCharacter('감');
```

### The hasProperty and hasValueInReadOnlyStringList functions have been removed.


They were removed as they are not closely related to the Hangul domain.

If needed, you can use the following method:

```tsx
export function hasValueInReadOnlyStringList<T extends string>(list: readonly T[], value: string): value is T {
return list.some(item => item === value);
}
export function hasProperty<T extends object, K extends PropertyKey>(obj: T, key: K): key is K & keyof T {
return Object.prototype.hasOwnProperty.call(obj, key);
}
```

### The hasSingleBatchim function has been removed.


The hasBatchim function now accepts an option to handle this use case.

```tsx
// ASIS
hasSingleBatchim('감');
// TOBE
hasBatchim('감', { only: "single" });
```


Loading

0 comments on commit 30f18b8

Please sign in to comment.