Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium-2505· Mistral AIHugging Face LMArena Human Preference 140K

create a saas login page with shopify polaris

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-flash’s answer.
  1. User

    create a saas login page with shopify polaris

  2. Mistral Assistant

    Shopify Polaris SAAS Login Page

    Here's a complete implementation of a SAAS login page using Shopify's Polaris design system. This includes a clean, modern login form with email/password fields, social login options, and a password recovery link.

    Implementation

    First, make sure you have the required dependencies installed:

    npm install @shopify/polaris @shopify/app-bridge-react @shopify/app-bridge-utils
    

    Here's the complete React component for the login page:

    import React, { useState } from 'react';
    import {
      Page,
      Layout,
      Card,
      Form,
      FormLayout,
      TextField,
      Button,
      Stack,
      Link,
      TextStyle,
      Banner,
      Divider,
      Icon
    } from '@shopify/polaris';
    import { Google, Facebook, Apple } from '@shopify/polaris-icons';
    
    function SaasLoginPage() {
      const [email, setEmail] = useState('');
      const [password, setPassword] = useState('');
      const [error, setError] = useState(null);
      const [loading, setLoading] = useState(false);
    
      const handleSubmit = (e) => {
        e.preventDefault();
        setLoading(true);
        setError(null);
    
        // Simulate API call
        setTimeout(() => {
          setLoading(false);
          if (email === 'demo@example.com' && password === 'password') {
            // Successful login - redirect or set auth state
            console.log('Login successful');
          } else {
            setError('Invalid email or password');
          }
        }, 1000);
      };
    
      const handleSocialLogin = (provider) => {
        setLoading(true);
        console.log(`Logging in with ${provider}`);
        // Implement your social login logic here
        setTimeout(() => setLoading(false), 1000);
      };
    
      return (
        <Page narrowWidth>
          <Layout>
            <Layout.Section>
              <Card sectioned>
                <div style={{ maxWidth: '400px', margin: '0 auto' }}>
                  <div style={{ textAlign: 'center', marginBottom: '2rem' }}>
                    <h1 style={{ fontSize: '2rem', fontWeight: '600' }}>Welcome Back</h1>
                    <TextStyle variation="subdued">
                      Log in to your account to continue
                    </TextStyle>
                  </div>
    
                  {error && (
                    <Banner
                      title="Login failed"
                      status="critical"
                      onDismiss={() => setError(null)}
                    >
                      {error}
                    </Banner>
                  )}
    
                  <Form onSubmit={handleSubmit}>
                    <FormLayout>
                      <TextField
                        label="Email"
                        type="email"
                        value={email}
                        onChange={setEmail}
                        autoComplete="email"
                        required
                      />
                      <TextField
                        label="Password"
                        type="password"
                        value={password}
                        onChange={setPassword}
                        autoComplete="current-password"
                        required
                      />
    
                      <Stack distribution="trailing">
                        <Link url="/recover">Forgot password?</Link>
                      </Stack>
    
                      <Button
                        primary
                        fullWidth
                        submit
                        loading={loading}
                      >
                        Log in
                      </Button>
                    </FormLayout>
                  </Form>
    
                  <div style={{ textAlign: 'center', margin: '1.5rem 0' }}>
                    <TextStyle variation="subdued">or continue with</TextStyle>
                  </div>
    
                  <Stack distribution="equalSpacing">
                    <Button
                      icon={<Icon source={Google} color="base" />}
                      plain
                      onClick={() => handleSocialLogin('Google')}
                    />
                    <Button
                      icon={<Icon source={Facebook} color="base" />}
                      plain
                      onClick={() => handleSocialLogin('Facebook')}
                    />
                    <Button
                      icon={<Icon source={Apple} color="base" />}
                      plain
                      onClick={() => handleSocialLogin('Apple')}
                    />
                  </Stack>
    
                  <Divider />
    
                  <div style={{ textAlign: 'center', marginTop: '1rem' }}>
                    <TextStyle variation="subdued">
                      Don't have an account?{' '}
                      <Link url="/signup">Sign up</Link>
                    </TextStyle>
                  </div>
                </div>
              </Card>
            </Layout.Section>
          </Layout>
        </Page>
      );
    }
    
    export default SaasLoginPage;
    

    Key Features

    1. Clean Polaris Design: Follows Shopify's design system for consistency
    2. Form Validation: Basic validation for required fields
    3. Social Login Options: Google, Facebook, and Apple login buttons
    4. Password Recovery: Link to reset password
    5. Error Handling: Displays error messages for failed login attempts
    6. Responsive Layout: Works well on different screen sizes
    7. Loading States: Visual feedback during form submission

    Customization Options

    You can easily customize this login page by:

    1. Changing the logo: Add your company logo at the top
    2. Modifying colors: Adjust the theme colors to match your brand
    3. Adding more fields: Include additional fields like "Remember me" checkbox
    4. Adjusting layout: Change the spacing or section organization
    5. Adding CAPTCHA: Implement security measures if needed

    Integration Notes

    To integrate this with your actual authentication system:

    1. Replace the mock API call in handleSubmit with your real authentication logic
    2. Implement proper error handling from your backend
    3. Set up proper redirect logic after successful login
    4. Configure the social login buttons with your actual provider credentials

    This implementation provides a solid foundation that you can build upon to create a professional SAAS login experience using Shopify Polaris.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.