Skip to content

Commit

Permalink
changed button to cta name
Browse files Browse the repository at this point in the history
  • Loading branch information
milewskibogumil committed Oct 16, 2024
1 parent 52813d7 commit 8ea9a4b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ImageDataProps } from '../image';
import styles from './button.module.scss'
import styles from './cta.module.scss'

export type Props = React.HTMLAttributes<HTMLAnchorElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
text?: string | React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
import Image from '@/components/ui/image'
import Button, { type Props as ButtonDataProps } from './button'
import Button, { type Props as ButtonDataProps } from './cta'
type Props = ButtonDataProps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ImageDataQuery } from '../image';
export { default } from './index.astro';
export { type Props as ButtonDataProps } from './button';
export { type Props as ButtonDataProps } from './cta';

export const ButtonDataQuery = (name: string) => `
${name} {
Expand Down
20 changes: 0 additions & 20 deletions apps/astro/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
---
import Layout from '@/src/layouts/Layout.astro'
import metadataFetch from '@/utils/metadata.fetch'
import sanityFetch from '@/utils/sanity.fetch'
import Button, { ButtonDataQuery, type ButtonDataProps } from '@/components/ui/button'
const metadata = await metadataFetch('Index_Page')
type QueryProps = {
button: ButtonDataProps
}
const data = await sanityFetch<QueryProps>({
query: `
*[_type == "Index_Page"][0] {
${ButtonDataQuery('button')}
}
`,
})
---

<Layout {...metadata}>
Expand All @@ -32,12 +18,6 @@ const data = await sanityFetch<QueryProps>({
magni qui deleniti ducimus. Quam accusamus eos id fugiat soluta corrupti modi maiores ab perspiciatis? Asperiores, sunt
aliquam rerum ipsum magnam perferendis vero sapiente id sint unde dolor adipisci repudiandae.
</p>

<div class="cta-wrapper">
<Button {...data.button} />
<Button {...data.button} theme="secondary" />
<Button>Test</Button>
</div>
</Layout>

<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Tooltip, Box, Text, } from '@sanity/ui';
import { isValidUrl } from "../../utils/is-valid-url";
import { InternalLinkableTypes } from "../../structure/internal-linkable-types";

const name = 'button';
const title = 'Button';
const name = 'cta';
const title = 'Call To Action (CTA)';
const icon = () => '🔘';

export default defineType({
Expand Down
4 changes: 2 additions & 2 deletions apps/sanity/structure/schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ const components = [
];

// UI Components
import button from '../schema/ui/button';
import cta from '../schema/ui/cta';
import seo from '../schema/ui/seo';
import PortableText from '../schema/ui/portable-text';
import Heading from '../schema/ui/portable-text/Heading';

const ui = [
button,
cta,
seo,
PortableText,
Heading,
Expand Down

0 comments on commit 8ea9a4b

Please sign in to comment.