Circumstancing skin rule – Best practices
- Skin rule let’s user to define the branding of an application and is very much tied to portal and loads on the initial load of portal.
- Skin loads on the initial load of portal.
- A portal should have(load) only one skin rule applied throughout. It is not advisable to dynamically change skins or versions of it within the same portal.
- Just like other rules, skin rule also can be circumstanced. However, there are few limitations in creating circumstancing skin rules.
- Skin circumstances should be created based on the properties available in Requestor level pages which do not change after the portal is loaded unlike thread level pages.
Good example:
Scenario:
Portal’s background, branding and other color combinations to be varied based on the logged in user country.
For example, portal should have ‘blue’ color if user is from India and should have ‘yellow’ color if user is from Australia.
Solution1: In this case, skin can be circumstanced based on the locale property of the operator. Clipboardpage “OperatorID” of instance Data-Admin-Operator-ID is a requestor level page.
This page has a property pyDefaultTimeZone which can be used to identify if the logged in user is from which country. Hence, this property value can be used while creating circumstancing skin rules.
Solution2: Without having to create circumstances of skin rule, this problem can be still solved using custom css. For this, we need to have an attribute in the dom on harness/portal level which can be used to distinguish between countries. Custom css can be written based on the set custom dom attribute.
Bad example:
Scenario:
Ability to switch between dark and light modes in a portal.
Bad implementation:
Creating circumstanced skin versions, one for light mode and other for dark mode.
On toggle mode, property using which skin is circumstanced is updated.
Why this won’t work:
- Skin loads only on initial load of portal, hence changing skins dynamically without having user to logout and login is not possible.
- Possibility of property that toggle mode updates is on thread level, since it should only update the current instance/session of the portal. Using such properties to create skin circumstances is not recommended.
Solution1: Circumstance harness rule instead which would have specific styles included for light and dark modes.
Solution2: Using custom css based on custom selectors which identifies the mode.