Skip to content

Commit

Permalink
feat: useSkoy() hook (#36)
Browse files Browse the repository at this point in the history
* feat: useSkoy() hook

* docs: re-install skoy.js

* docs: re-install skoy.js
  • Loading branch information
santhitak authored Oct 1, 2022
1 parent 52bd235 commit 24e1395
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-react": "^7.31.8",
"prettier": "2.7.1",
"skoy": "^0.3.2",
"typescript": "^4.8.4",
"vite": "^3.1.0"
}
Expand Down
11 changes: 11 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useRandom } from "./hooks/useRandom"
import { useDivisibleByThree } from "./hooks/useDivisibleByThree"
import { useSalim } from "./hooks/useSalim"
import { useAny } from "./hooks/useAny"
import { useSkoy } from "./hooks/useSkoy"

const UseWeirdExampleComponent = () => {
return (
Expand Down Expand Up @@ -204,6 +205,16 @@ function App() {
],
githubUsername: "narze",
},
{
desc: "useSkoy - returns SkoyLang for us SkoyPeople",
examples: [
{
code: `const value = useSkoy("รักมิใช่ดวงดาวเมื่อพราวแสง")`,
value: `${useSkoy("รักมิใช่ดวงดาวเมื่อพราวแสง")}`,
},
],
githubUsername: "santhitak",
},
] // Add your own hooks usage above this comment (at the end of the list)
// Create a new component if your hook needs more customization

Expand Down
7 changes: 7 additions & 0 deletions src/hooks/useSkoy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Skoy from "skoy"
import { useMemo } from "react"

export function useSkoy(m: string) {
const isSkoy = useMemo(() => Skoy.convert(m), [])
return isSkoy
}

1 comment on commit 24e1395

@vercel
Copy link

@vercel vercel bot commented on 24e1395 Oct 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

react-useless – ./

react-useless.vercel.app
react-useless-git-main-notnarze.vercel.app
react-useless-notnarze.vercel.app

Please sign in to comment.