Skip to content

Commit

Permalink
feat: Icon component (#38)
Browse files Browse the repository at this point in the history
* Preparing icon component

* Fixed icon schema

* Added default color

* Added semantic label

* Refactoring

* Review fix

* fix review

* Fix icon properties

* Better description of icon color.
  • Loading branch information
jonas-martinez authored Jan 4, 2022
1 parent 8c942fe commit de30cb9
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 7 deletions.
18 changes: 16 additions & 2 deletions api/components/button.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,24 @@
"$ref": "defs/listener.schema.json"
},
"leftIcon": {
"$ref": "defs/icon.schema.json"
"type": "component",
"properties": {
"type": {
"enum": [
"icon"
]
}
}
},
"rightIcon": {
"$ref": "defs/icon.schema.json"
"type": "component",
"properties": {
"type": {
"enum": [
"icon"
]
}
}
}
},
"required": [
Expand Down
9 changes: 8 additions & 1 deletion api/components/dropdownButton.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
"type": "component"
},
"icon": {
"$ref": "defs/icon.schema.json"
"type": "component",
"properties": {
"type": {
"enum": [
"icon"
]
}
}
}
},
"required": [
Expand Down
39 changes: 39 additions & 0 deletions api/components/icon.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "icon.schema.json",
"title": "Icon",
"description": "The Icon to use",
"type": "component",
"additionalProperties": false,
"required": [
"type",
"value"
],
"properties": {
"type": {
"description": "The type of the element",
"enum": [
"icon"
]
},
"size": {
"description": "The size of the Icon",
"type": "number",
"default": "1"
},
"color": {
"description": "The color of the Icon. If not set or null, the color is inherited from the theme.",
"$ref": "defs/color.schema.json",
"default": null
},
"semanticLabel": {
"description": "The semantic label for the Icon. This will be announced when using accessibility mode.",
"type": "string",
"default": null
},
"value": {
"description": "The value of the Icon",
"$ref": "defs/iconData.schema.json"
}
}
}
9 changes: 8 additions & 1 deletion api/components/menuItem.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
"default": false
},
"icon": {
"$ref": "defs/icon.schema.json"
"type": "component",
"properties": {
"type": {
"enum": [
"icon"
]
}
}
},
"onPressed": {
"$ref": "defs/listener.schema.json"
Expand Down
6 changes: 3 additions & 3 deletions api/defs/icon.schema.json → api/defs/iconData.schema.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "icon.schema.json",
"title": "Icon",
"description": "The Icon to use",
"$id": "iconData.schema.json",
"title": "IconData",
"description": "All of the possible values for an Icon.",
"type": "string",
"enum": [
"ac_unit",
Expand Down

0 comments on commit de30cb9

Please sign in to comment.