How can I use the IWC Component library for UI consistency?

209    Asked by Dadhijaraj in Salesforce , Asked on May 22, 2024

 I am a front-end developer currently working on q new project. My team has decided to use the IWC Component library for UI consistency. Describe to me how can I use the component from the library to create a user-friendly and visually appealing dashboard for a finance management application. 

Answered by Csaba Toth

In the context of Salesforce, here are the steps given:-

To create a user-friendly and visually appealing dashboard for a finance management application by using the IWC component library, you would need to import the necessary Components into your project first. This could be done by using a package manager like mom or yarn.

Next, you would need to import the required Component in your main application file typically “App.js” in a react project.

For the dashboard layout, you would need to use the “Sidebar” Component for navigation and the “Navbar” Component for top-level navigation and also the branding. The “chart” Component would be perfect to display financial data.

Here is the example given below which would be a snippet that Integrates multiple Component from the IWC Component library into a react application for creating a finance management dashboard:-

Import React from ‘react’;

Import { Sidebar, Navbar, Chart, Table } from ‘iwc-component-library’;

Const FinanceDashboard = () => {
  Const transactionData = [
    { date: ‘2024-01-01’, description: ‘Groceries’, amount: 50 },
    { date: ‘2024-01-05’, description: ‘Dinner’, amount: 30 },
    { date: ‘2024-01-10’, description: ‘Fuel’, amount: 40 },
    { date: ‘2024-01-15’, description: ‘Shopping’, amount: 100 },
    { date: ‘2024-01-20’, description: ‘Utilities’, amount: 80 },
  ];
  Const chartData = {
    Labels: [‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’],
    Datasets: [
      {
        Label: ‘Expenses’,
        Data: [1000, 1500, 1200, 1800, 2000, 1600],
        backgroundColor: ‘rgba(75,192,192,0.2)’,
        borderColor: ‘rgba(75,192,192,1)’,
        borderWidth: 1,
      },
    ],
  };
  Return (

   

     

     

       

       

          Monthly Expenses

         

          Transaction History

         

            Columns={[‘Date’, ‘Description’, ‘Amount’]}

            Data={transactionData}

          />

       

     

   

  );

};

Export default FinanceDashboard;

Here is the example given below by using python programming language:-

From flask import Flask, render_template
From iwc_component_library import Sidebar, Navbar, Chart, Table
App = Flask(__name__)
@app.route(‘/’)
Def finance_dashboard():
    Transaction_data = [
        {‘date’: ‘2024-01-01’, ‘description’: ‘Groceries’, ‘amount’: 50},
        {‘date’: ‘2024-01-05’, ‘description’: ‘Dinner’, ‘amount’: 30},
        {‘date’: ‘2024-01-10’, ‘description’: ‘Fuel’, ‘amount’: 40},
        {‘date’: ‘2024-01-15’, ‘description’: ‘Shopping’, ‘amount’: 100},
        {‘date’: ‘2024-01-20’, ‘description’: ‘Utilities’, ‘amount’: 80},
    ]
    Chart_data = {
        ‘labels’: [‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’, ‘May’, ‘Jun’],
        ‘datasets’: [
            {
                ‘label’: ‘Expenses’,
                ‘data’: [1000, 1500, 1200, 1800, 2000, 1600],
                ‘backgroundColor’: ‘rgba(75,192,192,0.2)’,
                ‘borderColor’: ‘rgba(75,192,192,1)’,
                ‘borderWidth’: 1,
            },
        ],
    }
    Return render_template(‘finance_dashboard.html’,
                           Transaction_data=transaction_data,
                           Chart_data=chart_data)
If __name__ == ‘__main__’:
    App.run(debug=True)


Your Answer