Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update components to use button component

Joshen Lim69676429a5d7
diff --git a/www/components/Card.tsx b/www/components/Card.tsx
index 1d8ba6c6e8f..3c0a1a59134 100644
--- a/www/components/Card.tsx
+++ b/www/components/Card.tsx
@@ -1,3 +1,5 @@
+import Button from 'components/Button'
+
type PostMetaProps = {
name: string,
avatarUrl: string,
@@ -95,11 +97,7 @@ const Card = (props: Props) => {
</div>
</div>
)}
- { ctaText && (
- <div className="mt-6 flex items-center text-sm text-brand-600">
- <a href={url}>{ctaText}</a>
- </div>
- )}
+ { ctaText && <Button className="mt-5" type="secondary" text={ctaText} url="#" /> }
</div>
</div>
)
diff --git a/www/components/Features/index.tsx b/www/components/Features/index.tsx
index df1e17b05ea..27197c7b37f 100644
--- a/www/components/Features/index.tsx
+++ b/www/components/Features/index.tsx
@@ -1,4 +1,5 @@
import Badge from 'components/Badge'
+import Button from 'components/Button'
import SectionHeader from 'components/UI/SectionHeader'
import Solutions from 'data/Solutions.json'
@@ -26,11 +27,8 @@ const Features = () => {
<div className="mt-5">
<dd className="mt-2 text-base text-gray-500 dark:text-gray-400">{description}</dd>
</div>
- {url && (
- <div className="mt-5">
- <a href="#" className="mt-2 text-sm text-brand-600 hover:underline">Learn more <span aria-hidden="true">&rarr;</span></a>
- </div>
- )}
+ { url && <Button className="mt-5" type="secondary" text="Learn more" url="#" /> }
+
</div>
)
})
diff --git a/www/components/MadeForDevelopers/index.tsx b/www/components/MadeForDevelopers/index.tsx
index 979af68f6e7..2c4bba471eb 100644
--- a/www/components/MadeForDevelopers/index.tsx
+++ b/www/components/MadeForDevelopers/index.tsx
@@ -1,3 +1,4 @@
+import Button from 'components/Button'
import Badge from 'components/Badge'
import SectionHeader from 'components/UI/SectionHeader'
import CodeExamples from 'components/MadeForDevelopers/CodeExamples'
@@ -22,15 +23,10 @@ const MadeForDevelopers = () => {
<dt className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
TypeScript support
</dt>
- <dd className="mt-2 text-base text-gray-500 mb-6 dark:text-dark-100">
+ <dd className="mt-3 text-base text-gray-500 mb-6 dark:text-dark-100">
Type definitions for both server side and client side
</dd>
- <button
- type="button"
- className="inline-flex items-center text-xs font-medium rounded transition text-brand-600 hover:text-brand-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-brand-500"
- >
- Explore more
- </button>
+ <Button type="secondary" text="Explore more" url="#" />
</div>
</div>
<div className="col-span-12 sm:col-span-6">
@@ -39,15 +35,10 @@ const MadeForDevelopers = () => {
Local emulator
<Badge>Coming Q1 2021</Badge>
</dt>
- <dd className="mt-2 text-base text-gray-500 mb-6 dark:text-dark-100">
+ <dd className="mt-3 text-base text-gray-500 mb-6 dark:text-dark-100">
Develop locally and push to production when you're ready
</dd>
- <button
- type="button"
- className="inline-flex items-center text-xs font-medium rounded transition text-brand-600 hover:text-brand-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-brand-500"
- >
- Get notified
- </button>
+ <Button type="secondary" text="Get notified" url="#" />
</div>
</div>
</dl>
diff --git a/www/components/button.tsx b/www/components/button.tsx
index 0d109b0fa24..aa1f129f30d 100644
--- a/www/components/button.tsx
+++ b/www/components/button.tsx
@@ -14,21 +14,32 @@ const Button = (props: Props) => {
} = props
const colorClass = type === 'primary'
- ? 'text-white bg-brand-600 hover:bg-brand-700'
- : 'text-black bg-none'
+ ? 'px-3 py-2 shadow-sm border border-transparent text-white bg-brand-600 hover:bg-brand-700'
+ : 'text-brand-600 bg-none'
+
+ const textClass = type === 'primary'
+ ? 'font-medium left-3 group-hover:left-0'
+ : 'font-normal'
+
+ const arrowClass = type === 'primary'
+ ? ''
+ : 'relative -left-1 group-hover:left-0'
const renderButton = () => (
<button
type="button"
className={`
- mt-1 inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium
- rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-brand-500
- group transition
- ${colorClass} ${className}
+ inline-flex items-center text-sm leading-4 rounded-md
+ focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-brand-500
+ group transition ${colorClass} ${className}
`}
>
- <span className={`relative transition-all ${url ? 'left-3 group-hover:left-0' : ''}`}>{text}</span>
- { url && <span className="ml-2 transition-all opacity-0 group-hover:opacity-100">→</span> }
+ <span className={`
+ relative transition-all ${url ? textClass : ''}
+ `}>
+ {text}
+ </span>
+ { url && <span className={`ml-2 transition-all opacity-0 group-hover:opacity-100 ${arrowClass}`}>→</span> }
</button>
)