-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Light documentation to offload Components knowledge (#265)
* Development Documentation for Visual customizability * properties.json * add comment for toggle data feature * update prt * rebuild
- Loading branch information
1 parent
6fe0db1
commit fa3a49b
Showing
4 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Development Documentation | ||
|
||
Notes on how we've developed things in this project. | ||
|
||
## Visual customizability | ||
|
||
One of our most important features is the ability to customize the UI of the Components. We currently support 2 implementations of this: | ||
|
||
1. CSS Variable Fallbacks | ||
|
||
CSS variables are the simplest way for developers to add UI customizability to the Component's. When defining an aesthetic style (color, border, etc), simply write it as an CSS variable with a fallback: | ||
|
||
``` | ||
main { | ||
background-color: var(--component-background-color, blue); | ||
} | ||
``` | ||
|
||
Leaving the variable undefined will allow it to be defined by the user like so: | ||
|
||
``` | ||
<nylas-component style="--component-background-color: black" /> | ||
``` | ||
|
||
2. `theme` Property | ||
|
||
Some Components also have a theme property to let us define multiple default themes but still allow the user to create a custom theme. | ||
|
||
``` | ||
<main class={theme ?? "a-default-theme"}> | ||
``` | ||
|
||
``` | ||
main.a-default-theme { | ||
background-color: var(--component-background-color, blue); | ||
} | ||
``` | ||
|
||
The user can redefine the style by replacing the theme property (and therefore removing the class name) and defining new values for the variables. | ||
|
||
``` | ||
<nylas-component theme="custom" style="--component-background-color: black" /> | ||
``` | ||
|
||
## `properties.json` | ||
|
||
All Components have a `properties.json` file to help keep track of Component's properties for the Nylas Docs and Nylas Dashboard. | ||
|
||
When adding a new property, make sure to define the property's label (actual property name), title (name in written English), type, and default value. Most types have a number of options associated with them as well. | ||
|
||
Some properties can be flagged with `noPreview` to signify that this property is not to be edited or shown for certain cases | ||
|
||
``` | ||
{ | ||
"label": "theme", | ||
"title": "Theme", | ||
"type": "string", | ||
"options": ["theme-1", "theme-2", "theme-3", "theme-4", "theme-5"], | ||
"value": "theme-1" | ||
}, | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fa3a49b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: