Skip to content

Commit

Permalink
feat: added Textarea tag.
Browse files Browse the repository at this point in the history
fix: removed Style irrelevant href.
fix: Button type properly for form submission.
  • Loading branch information
Almas-Ali committed Aug 19, 2024
1 parent 793a367 commit 2bd270d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fronty/html/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class Style(BaseElement):
def __init__(self, *children, **attributes):
super().__init__('style', *children, **attributes)
self.attributes['type'] = 'text/css' if 'type' not in attributes else attributes['type']
self.attributes['href'] = attributes['href'] if 'href' in attributes else ''
# self.attributes['href'] = attributes['href'] if 'href' in attributes else ''
self.attributes['rel'] = 'stylesheet' if 'rel' not in attributes else attributes['rel']

def render(self):
Expand Down Expand Up @@ -398,7 +398,7 @@ class Button(BaseElement):

def __init__(self, *children, **attributes):
super().__init__('button', *children, **attributes)
self.attributes['type'] = 'button'
self.attributes['type'] = 'button' if 'type' not in attributes else attributes['type']


class Input(BaseElement):
Expand Down Expand Up @@ -795,6 +795,15 @@ def __str__(self):
return self.render()


class Textarea(BaseElement):
'''Textarea element.'''

def __init__(self, col: int = 5, row: int = 5, *children, **attributes):
super().__init__('textarea', *children, **attributes)
self.attributes['cols'] = col
self.attributes['rows'] = row


AnyHTMLElement = Union[
Html,
Head,
Expand Down Expand Up @@ -857,4 +866,5 @@ def __str__(self):
Source,
I,
Empty,
Textarea,
]

0 comments on commit 2bd270d

Please sign in to comment.