|
@@ -1,36 +1,44 @@
|
|
-from typing import Literal
|
|
|
|
|
|
+from typing import Literal, Optional
|
|
|
|
|
|
from ..element import Element
|
|
from ..element import Element
|
|
|
|
|
|
|
|
|
|
class Avatar(Element):
|
|
class Avatar(Element):
|
|
- def __init__(self, icon: str = "", color: str = "primary", text_color: str | None = None, size: str | None = None,
|
|
|
|
- font_size: str | None = None, shape: Literal['roundend', 'square'] | None = None) -> None:
|
|
|
|
|
|
+
|
|
|
|
+ def __init__(self,
|
|
|
|
+ icon: str = 'none', *,
|
|
|
|
+ color: str = 'primary',
|
|
|
|
+ text_color: Optional[str] = None,
|
|
|
|
+ size: Optional[str] = None,
|
|
|
|
+ font_size: Optional[str] = None,
|
|
|
|
+ square: bool = False,
|
|
|
|
+ rounded: bool = False,
|
|
|
|
+ ) -> None:
|
|
"""Avatar
|
|
"""Avatar
|
|
|
|
|
|
A avatar element wrapping Quasar's
|
|
A avatar element wrapping Quasar's
|
|
`QAvatar <https://quasar.dev/vue-components/avatar>`_ component.
|
|
`QAvatar <https://quasar.dev/vue-components/avatar>`_ component.
|
|
|
|
|
|
- :param icon: the name of the icon or icon path (img:path/to/some_image.png)
|
|
|
|
- :param color: color name for component from the Quasar Color Palette, examples: primary, teal-10.
|
|
|
|
- :param text_color: color name from the Quasar Color Palette, examples: primary, teal-10.
|
|
|
|
- :param size: size in CSS units, including unit name or standard size name (xs|sm|md|lg|xl), examples: 16px, 2rem.
|
|
|
|
- :param font_size: size in CSS units, including unit name, of the content (icon, text), examples: 18px, 2rem.
|
|
|
|
- :param shape: shape of the avatar, examples: roundend, square.
|
|
|
|
|
|
+ :param icon: name of the icon or image path with "img:" prefix (e.g. "map", "img:path/to/image.png")
|
|
|
|
+ :param color: color name for component from the Quasar Color Palette (e.g. "primary", "teal-10")
|
|
|
|
+ :param text_color: color name from the Quasar Color Palette (e.g. "primary", "teal-10")
|
|
|
|
+ :param size: size in CSS units, including unit name or standard size name (xs|sm|md|lg|xl) (e.g. "16px", "2rem")
|
|
|
|
+ :param font_size: size in CSS units, including unit name, of the content (icon, text) (e.g. "18px", "2rem")
|
|
|
|
+ :param square: removes border-radius so borders are squared (default: False)
|
|
|
|
+ :param rounded: applies a small standard border-radius for a squared shape of the component (default: False)
|
|
"""
|
|
"""
|
|
- super().__init__("q-avatar")
|
|
|
|
|
|
+ super().__init__('q-avatar')
|
|
|
|
|
|
- self._props["icon"] = icon
|
|
|
|
- self._props["color"] = color
|
|
|
|
|
|
+ self._props['icon'] = icon
|
|
|
|
+ self._props['color'] = color
|
|
|
|
+ self._props['square'] = square
|
|
|
|
+ self._props['rounded'] = rounded
|
|
|
|
|
|
if text_color is not None:
|
|
if text_color is not None:
|
|
- self._props["text-color"] = text_color
|
|
|
|
|
|
+ self._props['text-color'] = text_color
|
|
|
|
|
|
if size is not None:
|
|
if size is not None:
|
|
- self._props["size"] = size
|
|
|
|
|
|
+ self._props['size'] = size
|
|
|
|
|
|
if font_size is not None:
|
|
if font_size is not None:
|
|
- self._props["font-size"] = font_size
|
|
|
|
-
|
|
|
|
- if shape is not None:
|
|
|
|
- self._props[shape] = True
|
|
|
|
|
|
+ self._props['font-size'] = font_size
|