Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss what should be customizable #17

Closed
2byrds opened this issue Dec 11, 2023 · 8 comments
Closed

Discuss what should be customizable #17

2byrds opened this issue Dec 11, 2023 · 8 comments
Assignees

Comments

@2byrds
Copy link
Collaborator

2byrds commented Dec 11, 2023

The KERIA provider will provide a URL that allows you to download the customization needs (color pallete, icons, fonts?, etc) that will make it look like their website. We should make a list of things that could be customized. @HunnySajid will research what can be changed and post it here.

Also, post two separate versions that are configured differently to show the difference.

@2byrds
Copy link
Collaborator Author

2byrds commented Jan 22, 2024

From our meeting today:

  • In terms of settings, instead of just a KERIA URL, you give a configuration URL for KERIA agent, theming, etc. That should be 'basic' settings/configuration.

@HunnySajid
Copy link
Collaborator

HunnySajid commented Jan 23, 2024

@rodolfomiranda @2byrds
These are my findings regarding how we can approach white-label customization.

I have set up a fake JSON server hosted at my-json-server.typicode.com

Host Permissions:
To make a network request to a certain host, we have to add the host under host_permissions in manifest.json v3.

// manifest.json
"host_permissions": ["*://*.typicode.com/"]

UPDATE: We don't need host_permissions for fetch request.

Vendors are supposed to do so too. We can either utilize the my-json-server or make our own. The point is, that every host should be listed in manifest.json. We will build a consensus on the structure of JSON.

A user would enter the JSON URL provided by the Vendor to fetch the theme.


⚠️ Caveats

Tailwind CSS is a static utility-first CSS framework, and its configuration is determined at build time. Although it helps with all its utilities for rapid development, the limitation is that we can not build a fully dynamic theme with it. There could be different variants of theme e.g vendor1-dark, vendor2-light but theme files should exist e.g tailwind.vendor1-dark.config.js, tailwind.vendor2-light.config.js on the system.

💡Alternate Approach

We can either go for

  • Dynamic CSS Injection:
    Create a dynamic CSS file that includes variables for customizable values (colors, fonts, etc.). When the vendor updates the JSON, generate the CSS file dynamically on the server and serve it to your extension.

  • Styled-Components:
    styled-components allows the creation of components with scoped styles. We can dynamically change styles based on data from JSON files and inject them as themes in ThemeProvider.

In both cases, we would be replacing the current Tailwind-based implementation. Styled-components is a robust css-in-js framework that works well with React and also offers composability. If we are going this way, would suggest replacing tailwind with style components.

@2byrds
Copy link
Collaborator Author

2byrds commented Jan 23, 2024

@rodolfomiranda @2byrds
These are my findings regarding how we can approach white-label customization.

I have set up a fake JSON server hosted at my-json-server.typicode.com

Host Permissions:
To make a network request to a certain host, we have to add the host under host_permissions in manifest.json v3.

// manifest.json
"host_permissions": ["*://*.typicode.com/"]

Vendors are supposed to do so too. We can either utilize the my-json-server or make our own. The point is, that every host should be listed in manifest.json. We will build a consensus on the structure of JSON.

A user would enter the JSON URL provided by the Vendor to fetch the theme.


⚠️ Caveats

Tailwind CSS is a static utility-first CSS framework, and its configuration is determined at build time. Although it helps with all its utilities for rapid development, the limitation is that we can not build a fully dynamic theme with it. There could be different variants of theme e.g vendor1-dark, vendor2-light but theme files should exist e.g tailwind.vendor1-dark.config.js, tailwind.vendor2-light.config.js on the system.

💡Alternate Approach

We can either go for

  • Dynamic CSS Injection:
    Create a dynamic CSS file that includes variables for customizable values (colors, fonts, etc.). When the vendor updates the JSON, generate the CSS file dynamically on the server and serve it to your extension.

  • Styled-Components:
    styled-components allows the creation of components with scoped styles. We can dynamically change styles based on data from JSON files and inject them as themes in ThemeProvider.

In both cases, we would be replacing the current Tailwind-based implementation. Styled-components is a robust css-in-js framework that works well with React and also offers composability. If we are going this way, would suggest replacing tailwind with style components.

Thank you @HunnySajid . Looking forward to discussing

@HunnySajid
Copy link
Collaborator

HunnySajid commented Jan 23, 2024

Based on the discussion in our call today, just figured out we don't need host permissions to make a fetch call.

@2byrds
Copy link
Collaborator Author

2byrds commented Jan 29, 2024

@HunnySajid will provide the JSON on this issue to show what is customizable.

@HunnySajid
Copy link
Collaborator

White Label Customization Demo

Screen.Recording.2024-01-26.at.9.47.53.PM.mov

@HunnySajid
Copy link
Collaborator

JSON Example

{
  "title": "FaceBook",
  "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/Facebook_Logo_2023.png/1200px-Facebook_Logo_2023.png",
  "icon":"https://cdn-icons-png.flaticon.com/128/3955/3955011.png",
  "theme": {
    "colors": {
      "primary": "#4c6edf",
      "secondary": "#2ad881",
      "error": "#f55877",
      "heading": "#273444",
      "text": "#5A5252",
      "subtext": "#d3dce6",
      "white": "#ffffff",
      "black": "#373e49",
      "body": "#252430",
      "str":"asd"
    }
  }
}

@2byrds
Copy link
Collaborator Author

2byrds commented Feb 1, 2024

White Label Customization Demo

Screen.Recording.2024-01-26.at.9.47.53.PM.mov

awesome @HunnySajid

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants