Remix

How to Implement Frontend Design Customization in Shopify Remix App?

In this blog post, we’ll show you how to implement frontend design customization in the Shopify remix app!

Customizing the frontend design of your Shopify store is crucial for creating a unique user experience that aligns with your brand. With the Shopify Remix App, you can leverage the power of Remix to implement seamless design customizations using modern web technologies like React, Shopify Polaris, and more.

In this blog, we’ll guide you through the essential steps to customize the frontend of your Shopify store using the Remix framework.

Prerequisites:

Before proceeding, ensure that you have created an app.demo.jsx file in the app section and widget-customize.jsx file in the component section.

Steps to Impelent Frontend Design Customization in Shopify Remix App:

Step 1: First, we need to add the following code into widget-customize.jsx file.

import {
    Text,
    TextField,
    IndexTable,
    LegacyCard,
    InlineGrid,
    Badge,
    useBreakpoints,
    useIndexResourceState,
    Page,
    Card,
    Box,
    Button,
    Divider,
    Image,
    InlineStack,
    Layout
} from '@shopify/polaris';

import { useState, useCallback } from 'react';

function WidgetCustomize() {
    const [buttonTextColor, setButtonTextColor] = useState('#ffffff');
    const [buttonBackgroundColor, setButtonBackgroundColor] = useState('#1E418E');

    const handleButtonTextColorChange = useCallback((value) => setButtonTextColor(value), []);
    const handleButtonBackgroundColorChange = useCallback((value) => setButtonBackgroundColor(value), []);

    return (
        <>
            <Layout>
                <Layout.Section variant="oneHalf">
                    <Card>
                        <InlineGrid columns={['twoThirds', 'oneThird']} gap="400" >
                            <Text variant="headingSm" as="h6">
                                Button Text Color
                            </Text>
                            <TextField
                                type='color'
                                value={buttonTextColor}
                                onChange={handleButtonTextColorChange}
                                autoComplete="off"
                            />
                        </InlineGrid>
                        <Box paddingBlock="200"></Box>
                        <InlineGrid columns={['twoThirds', 'oneThird']} gap="400" >
                            <Text variant="headingSm" as="h6">
                                Button Background Color
                            </Text>
                            <TextField
                                type='color'
                                value={buttonBackgroundColor}
                                onChange={handleButtonBackgroundColorChange}
                                autoComplete="off"
                            />
                        </InlineGrid>
                    </Card>
                </Layout.Section>
                <Layout.Section variant="oneHalf">
                    <div className="magecomp">
                        <Box paddingBlock="200"></Box>
                        <button style={{ padding: '15px', width: '70%', borderRadius: '7px', border: 'none', fontSize: '18px', backgroundColor: buttonBackgroundColor, color: buttonTextColor }}
                            >Continue</button>
                    </div>
                </Layout.Section>
            </Layout>
        </>
    );
}

export default WidgetCustomize;

Step 2: After that, add the following code to app.demo.jsx file

import {
    Page,
    Box,
} from '@shopify/polaris';

import { useState, useCallback, useEffect } from 'react';
import WidgetCustomize from './components/widget-customize'

export default function Index() {

    const [buttonTextColor, setButtonTextColor] = useState('#ffffff');
    const [buttonBackgroundColor, setButtonBackgroundColor] = useState('#1E418E');

    const handleButtonTextColorChange = useCallback((value) => setButtonTextColor(value), []);
    const handleButtonBackgroundColorChange = useCallback((value) => setButtonBackgroundColor(value), []);

    const [selected, setSelected] = useState(0);
    const handleTabChange = useCallback(
        (selectedTabIndex) => setSelected(selectedTabIndex),
        [],
    );

    return (
        <>
            <Page>
                <Box paddingBlock={200}></Box>
                {selected === 0 && <WidgetCustomize
                 buttonTextColor={buttonTextColor}
                    buttonBackgroundColor={buttonBackgroundColor}
                    handleButtonTextColorChange={handleButtonTextColorChange}
                    handleButtonBackgroundColorChange={handleButtonBackgroundColorChange}
                />}
                <Box padding={400}></Box>
            </Page>
        </>
    );
}

Output:

After implementing the above steps, save the file and check the app frontend. You will have this view on the frontend.

After that, you can change the button design and text color from here like the image below.

Conclusion:

Using this code you can easily customize your app settings and also create user-friendly interface. You can even save this data in the database and display it on the storefront.

Click to rate this post!
[Total: 1 Average: 5]
Bharat Desai

Bharat Desai is a Co-Founder at MageComp. He is an Adobe Magento Certified Frontend Developer ? with having 8+ Years of experience and has developed 150+ Magento 2 Products with MageComp. He has an unquenchable thirst to learn new things. On off days you can find him playing the game of Chess ♟️ or Cricket ?.

Recent Posts

Improving Error Handling and Transition Management in Remix with useRouteError and useViewTransitionState

In modern web development, seamless navigation and state management are crucial for delivering a smooth…

6 days ago

Magento Open Source 2.4.8-Beta Release Notes

Magento Open Source 2.4.8 beta version released on October  8, 2024. The latest release of…

1 week ago

How to Create Catalog Price Rule in Magento 2 Programmatically?

Hello Magento Friends, Creating catalog price rules programmatically in Magento 2 can be a valuable…

1 week ago

Top 10 Tips to Hire Shopify Developers

As the world of eCommerce continues to thrive, Shopify has become one of the most…

2 weeks ago

Managing Browser Events and Navigation in Shopify Remix: useBeforeUnload, useHref, and useLocation Hooks

Shopify Remix is an innovative framework that provides a streamlined experience for building fast, dynamic,…

2 weeks ago

Ultimate Guide to Hiring a Top Shopify Development Agency

Building a successful eCommerce store requires expertise, and for many businesses, Shopify has become the…

2 weeks ago