Skip to content

Commit

Permalink
fix: ViewSource PascalCase
Browse files Browse the repository at this point in the history
  • Loading branch information
lerte committed Oct 15, 2024
1 parent 9f55204 commit ef0b22a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/docs/src/components/ViewSource.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { Icon, IconButton, Tooltip } from 'actify'

const hyphenToPascalCase = (str: string) => {
return str
.split('-')
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join('')
}

const ViewSource = ({ name }: { name: string }) => {
const capitalize = name.charAt(0).toUpperCase() + name.slice(1)
const sourceUrl = `https://github.com/actifyjs/actify/tree/main/packages/actify/src/components/${capitalize}`
const pascalCase = hyphenToPascalCase(name)

const sourceUrl = `https://github.com/actifyjs/actify/tree/main/packages/actify/src/components/${pascalCase}`
return (
<Tooltip placement="top" content="View source on Github">
<a tabIndex={-1} target="_blank" href={sourceUrl}>
Expand Down

0 comments on commit ef0b22a

Please sign in to comment.