Skip to content

Commit

Permalink
docs: Icon updates (#334)
Browse files Browse the repository at this point in the history
* icons: Update documentation for icons.

This commit updates the schema documentation for icons to match the icon
validation in the community repo.

* icons: Update icon usage.

This commit updates all examples to use icons that will validate in the
community repo.
  • Loading branch information
betterengineering authored Jul 25, 2022
1 parent d8a4733 commit 6ecb268
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion docs/schema/datetime/example.star
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_schema():
id = "event_time",
name = "Event Time",
desc = "The time of the event.",
icon = "cog",
icon = "gear",
),
],
)
6 changes: 3 additions & 3 deletions docs/schema/generated/example.star
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def more_options(pet):
id = "leash",
name = "Leash",
desc = "A toggle to enable a dog leash.",
icon = "cog",
icon = "gear",
default = False,
),
]
Expand All @@ -51,7 +51,7 @@ def more_options(pet):
id = "litter-box",
name = "Litter Box",
desc = "A toggle to enable a litter box.",
icon = "cog",
icon = "gear",
default = False,
),
]
Expand All @@ -66,7 +66,7 @@ def get_schema():
id = "pet",
name = "Pet Type",
desc = "What type of pet do you have?",
icon = "cog",
icon = "gear",
),
schema.Generated(
id = "generated",
Expand Down
2 changes: 1 addition & 1 deletion docs/schema/location/example.star
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_schema():
id = "location",
name = "Location",
desc = "Location for which to display time.",
icon = "place",
icon = "locationDot",
),
],
)
2 changes: 1 addition & 1 deletion docs/schema/photoselect/example.star
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_schema():
id = "photo",
name = "Add Photo",
desc = "A photo to display.",
icon = "cog",
icon = "gear",
),
],
)
Expand Down
18 changes: 9 additions & 9 deletions docs/schema/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The `get_schema` method returns a `schema.Schema` object that contains _fields_.
Next up should be more familiar. We're now passing `config` into `main()`. This is the same for current pixlet scripts that take `config` today. In [Community Apps](https://github.com/tidbyt/community), we will populate the config hashmap with values configured from the mobile app.

## Icons
Each schema field takes an `icon` value. We use the free icons from [Font Awesome](https://fontawesome.com/) with the names camel cased. For example [users-cog](https://fontawesome.com/v5.15/icons/users-cog?style=solid) should be `usersCog` in the `icon` value.
Each schema field takes an `icon` value. We use the free icons from [Font Awesome](https://fontawesome.com/v6/search?s=solid%2Cbrands) at version 6.1.1 with the names camel cased. For example [users-cog](https://fontawesome.com/v6/icons/users-cog?style=solid&s=solid) should be `usersCog` in the `icon` value. When submitting to the community repo, the icon names are validated against this [icon map](https://github.com/tidbyt/community/blob/main/apps/icons.go).

## Dynamic Fields
Pixlet offers two types of fields: basic fields like `Toggle` or `Text` and dynamic fields that take a `handler` method like `LocationBased` or `Typeahead`. For dynamic fields, the `handler` will get called with user inputs. What the handler returns is specific to the field.
Expand All @@ -83,7 +83,7 @@ schema.DateTime(
id = "event_time",
name = "Event Time",
desc = "The time of the event.",
icon = "cog",
icon = "gear",
)
```

Expand Down Expand Up @@ -149,7 +149,7 @@ def more_options(pet):
id = "leash",
name = "Leash",
desc = "A toggle to enable a dog leash.",
icon = "cog",
icon = "gear",
default = False,
),
]
Expand All @@ -159,7 +159,7 @@ def more_options(pet):
id = "litter-box",
name = "Litter Box",
desc = "A toggle to enable a litter box.",
icon = "cog",
icon = "gear",
default = False,
),
]
Expand All @@ -178,7 +178,7 @@ schema.Location(
id = "location",
name = "Location",
desc = "Location for which to display time.",
icon = "place",
icon = "locationDot",
)
```

Expand Down Expand Up @@ -290,7 +290,7 @@ schema.PhotoSelect(
id = "photo",
name = "Add Photo",
desc = "A photo to display.",
icon = "cog",
icon = "gear",
)
```

Expand All @@ -311,7 +311,7 @@ schema.Text(
id = "msg",
name = "Message",
desc = "A message to display.",
icon = "cog",
icon = "gear",
default = "Hello",
)
```
Expand All @@ -327,7 +327,7 @@ schema.Toggle(
id = "party_mode",
name = "Party Mode",
desc = "A toggle to enable party mode.",
icon = "cog",
icon = "gear",
default = False,
)
```
Expand All @@ -348,7 +348,7 @@ schema.Typeahead(
id = "search",
name = "Search",
desc = "A list of items that match search.",
icon = "cog",
icon = "gear",
handler = search,
)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/schema/text/example.star
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get_schema():
id = "msg",
name = "Message",
desc = "A message to display.",
icon = "cog",
icon = "gear",
default = "Hello",
),
],
Expand Down
2 changes: 1 addition & 1 deletion docs/schema/toggle/example.star
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_schema():
id = "party_mode",
name = "Party Mode",
desc = "A toggle to enable party mode.",
icon = "cog",
icon = "gear",
default = False,
),
],
Expand Down
2 changes: 1 addition & 1 deletion docs/schema/typeahead/example.star
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_schema():
id = "search",
name = "Search",
desc = "A list of items that match search.",
icon = "cog",
icon = "gear",
handler = search,
),
],
Expand Down
2 changes: 1 addition & 1 deletion examples/sunrise.star
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_schema():
id = "location",
name = "Location",
desc = "Location for which to display time.",
icon = "place",
icon = "locationDot",
),
],
)
4 changes: 2 additions & 2 deletions schema/datetime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ t = schema.DateTime(
id = "event_name",
name = "Event Name",
desc = "The time of the event.",
icon = "cog",
icon = "gear",
)
assert(t.id == "event_name")
assert(t.name == "Event Name")
assert(t.desc == "The time of the event.")
assert(t.icon == "cog")
assert(t.icon == "gear")
def main():
return []
Expand Down
4 changes: 2 additions & 2 deletions schema/location_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ s = schema.Location(
id = "location",
name = "Location",
desc = "Location for which to display time.",
icon = "place",
icon = "locationDot",
)
assert(s.id == "location")
assert(s.name == "Location")
assert(s.desc == "Location for which to display time.")
assert(s.icon == "place")
assert(s.icon == "locationDot")
def main():
return []
Expand Down
4 changes: 2 additions & 2 deletions schema/photoselect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ t = schema.PhotoSelect(
id = "photo",
name = "Add Photo",
desc = "A photo.",
icon = "cog",
icon = "gear",
)
assert(t.id == "photo")
assert(t.name == "Add Photo")
assert(t.desc == "A photo.")
assert(t.icon == "cog")
assert(t.icon == "gear")
def main():
return []
Expand Down
20 changes: 10 additions & 10 deletions schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ def get_schema():
id = "locationid",
name = "Location",
desc = "A Location",
icon = "place",
icon = "locationDot",
),
schema.LocationBased(
id = "locationbasedid",
name = "Locationbased",
desc = "A Locationbased",
icon = "place",
icon = "locationDot",
handler = locationbasedhandler,
),
schema.Toggle(
Expand All @@ -67,7 +67,7 @@ def get_schema():
id = "textid",
name = "Text",
desc = "A Text",
icon = "cog",
icon = "gear",
default = "Default text",
),
schema.Dropdown(
Expand Down Expand Up @@ -136,15 +136,15 @@ def main():
ID: "locationid",
Name: "Location",
Description: "A Location",
Icon: "place",
Icon: "locationDot",
},
{
Type: "locationbased",
ID: "locationbasedid",
Name: "Locationbased",
Description: "A Locationbased",
Handler: "locationbasedhandler",
Icon: "place",
Icon: "locationDot",
},
{
Type: "onoff",
Expand All @@ -159,7 +159,7 @@ def main():
ID: "textid",
Name: "Text",
Description: "A Text",
Icon: "cog",
Icon: "gear",
Default: "Default text",
},
{
Expand Down Expand Up @@ -251,14 +251,14 @@ def get_schema():
"name": "Location",
"description": "A Location",
"id": "locationid",
"icon": "place",
"icon": "locationDot",
},
{"type": "locationbased",
"id": "locationbasedid",
"name": "Locationbased",
"description": "A Locationbased",
"handler": "locationbasedhandler",
"icon": "place",
"icon": "locationDot",
},
{"type": "onoff",
"id": "onoffid",
Expand Down Expand Up @@ -373,15 +373,15 @@ def main():
ID: "locationid",
Name: "Location",
Description: "A Location",
Icon: "place",
Icon: "locationDot",
},
{
Type: "locationbased",
ID: "locationbasedid",
Name: "Locationbased",
Description: "A Locationbased",
Handler: "locationbasedhandler",
Icon: "place",
Icon: "locationDot",
},
{
Type: "onoff",
Expand Down
4 changes: 2 additions & 2 deletions schema/typeahead_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ t = schema.Typeahead(
id = "search",
name = "Search",
desc = "A list of items that match search.",
icon = "cog",
icon = "gear",
handler = search,
)
assert(t.id == "search")
assert(t.name == "Search")
assert(t.desc == "A list of items that match search.")
assert(t.icon == "cog")
assert(t.icon == "gear")
assert(t.handler("")[0].display == "Grand Central")
def main():
Expand Down

0 comments on commit 6ecb268

Please sign in to comment.