Skip to content

Commit

Permalink
fix(vue): Fix subtitles, move into context
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Sep 6, 2024
1 parent 7256e24 commit 635331e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/create-react/src/components/views/LoginView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { AppContext } from '../../context';

/** Login page, showing a button that redirects to login form. */
export default function LoginView() {
const { title, logo } = useContext(AppContext);
const { title, subtitle, logo } = useContext(AppContext);
const { loginWithRedirect } = useAuth0();
return (
<main className="login">
{logo && <img className="login-logo" src={logo.src} alt={logo.alt} />}
<h1 className="title">{title}</h1>
<p className="subtitle">Discover the power of developing with React</p>
<p className="subtitle">{subtitle}</p>
<button className="body1" onClick={() => loginWithRedirect()}>
Login with CARTO
</button>
Expand Down
2 changes: 2 additions & 0 deletions packages/create-react/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import cartoLogo from '/carto.svg';

export interface AppContextProps {
title: string;
subtitle: string;
logo?: {
src: string;
alt: string;
Expand All @@ -28,6 +29,7 @@ export interface AppContextProps {

export const DEFAULT_APP_CONTEXT = {
title: import.meta.env.VITE_APP_TITLE,
subtitle: 'Discover the power of developing with React',
logo: {
src: cartoLogo,
alt: 'CARTO logo',
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vue/src/components/views/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { loginWithRedirect } = useAuth0();
:alt="context.logo.alt"
/>
<h1 class="title">{{ context.title }}</h1>
<p class="subtitle">Discover the power of developing with React</p>
<p class="subtitle">{{ context.subtitle }}</p>
<button class="body1" @click="() => loginWithRedirect()">
Login with CARTO
</button>
Expand Down
2 changes: 2 additions & 0 deletions packages/create-vue/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import cartoLogo from '/carto.svg';

export interface AppContext {
title: string;
subtitle: string;
logo?: {
src: string;
alt: string;
Expand All @@ -27,6 +28,7 @@ export interface AppContext {

export const DEFAULT_APP_CONTEXT: AppContext = {
title: import.meta.env.VITE_APP_TITLE,
subtitle: 'Discover the power of developing with Vue',
logo: {
src: cartoLogo,
alt: 'CARTO logo',
Expand Down

0 comments on commit 635331e

Please sign in to comment.