Skip to content

Commit

Permalink
Migrate button
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Mar 7, 2024
1 parent c66efc1 commit cb3227f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 36 deletions.
11 changes: 11 additions & 0 deletions app/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,17 @@ tbody tr:last-child td {
@apply rounded-lg py-2.5 px-5;
}

.btn-subtle {
@apply bg-ens-light-background-primary dark:bg-ens-dark-background-primary;
@apply text-ens-light-text-secondary dark:text-ens-dark-text-secondary;
@apply hover:bg-ens-light-background-secondary dark:hover:bg-ens-dark-background-secondary hover:text-ens-light-text-secondary hover:dark:text-ens-dark-text-secondary;
@apply active:bg-ens-light-blue-bright dark:active:bg-ens-dark-blue-bright; /* */
@apply focus:ring focus:ring-offset-2 focus:ring-ens-light-border dark:focus:ring-ens-dark-border focus:outline-none; /* */
@apply border border-ens-light-border dark:border-ens-dark-border;
@apply rounded-lg py-2.5 px-5;
@apply font-bold;
}

.input {
@apply block w-full border border-ens-light-border dark:border-ens-dark-border;
@apply outline-none;
Expand Down
69 changes: 35 additions & 34 deletions app/src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ArrowIcon: FC = (properties) => {
const variantStyles = {
primary: 'btn-blue-primary',
disabled: 'btn-disabled',
subtle: 'btn-subtle',
red: 'btn-red-primary',
secondary: 'btn-blue-surface',
green: 'rounded-lg py-1 px-3 bg-green-400/10 text-green-600 ring-1 ring-inset ring-green-400/20 hover:bg-green-400/10 hover:text-green-300 hover:ring-green-300',
Expand Down Expand Up @@ -62,34 +63,6 @@ export const Button: FC<

className = clsx('btn', variantStyles[newVariant], className);

const arrowIcon = (
<ArrowIcon
// @ts-ignore
className={cx(
'mt-0.5 h-5 w-5',
variant === 'text' && 'relative top-px',
arrow === 'left' && '-ml-1 rotate-180',
arrow === 'right' && '-mr-1'
)}
/>
);

return (
// @ts-ignore
<thorin-button
href={properties['href']}
onClick={properties['onClick']}
target={properties['target']}
width={properties['width']}
variant={newVariant}
>
{arrow === 'left' && arrowIcon}
{children}
{arrow === 'right' && arrowIcon}
{/* @ts-ignore */}
</thorin-button>
);

// const arrowIcon = (
// <ArrowIcon
// // @ts-ignore
Expand All @@ -103,17 +76,45 @@ export const Button: FC<
// );

// return (
// <Component
// // @ts-ignore
// <thorin-button
// href={properties['href']}
// target={properties['target']}
// onClick={properties['onClick']}
// className={className}
// disabled={disabled}
// {...properties}
// target={properties['target']}
// width={properties['width']}
// variant={newVariant}
// >
// {arrow === 'left' && arrowIcon}
// {children}
// {arrow === 'right' && arrowIcon}
// </Component>
// {/* @ts-ignore */}
// </thorin-button>
// );

const arrowIcon = (
<ArrowIcon
// @ts-ignore
className={cx(
'mt-0.5 h-5 w-5',
variant === 'text' && 'relative top-px',
arrow === 'left' && '-ml-1 rotate-180',
arrow === 'right' && '-mr-1'
)}
/>
);

return (
<Component
href={properties['href']}
target={properties['target']}
onClick={properties['onClick']}
className={className}
disabled={disabled}
{...properties}
>
{arrow === 'left' && arrowIcon}
{children}
{arrow === 'right' && arrowIcon}
</Component>
);
};
4 changes: 2 additions & 2 deletions docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export const meta = {
<p>Learn about building applications with decentralized identity.</p>

<div className="flex gap-3 flex-col sm:flex-row">
<thorin-button href="/learn/protocol">Open Docs</thorin-button>
<thorin-button variant="subtle" href="/web/quickstart">Integrate into your app!</thorin-button>
<Button href="/learn/protocol">Open Docs</Button>
<Button variant="subtle" href="/web/quickstart">Integrate into your app!</Button>
</div>
</div>

Expand Down

0 comments on commit cb3227f

Please sign in to comment.