Refactor upload component and add styled upload component
Description
These changes add default styling to the upload component - It follows the same pattern as the form component, where the root method call accesses the unstyled component.
Some default styles were commented so as not to break a previous test in the rendering of forms (With permission, I'd like to refactor the test).
Closes #2967
All Submissions:
- [ β ] Have you followed the guidelines stated in CONTRIBUTING.md file?
- [ β ] Have you checked to ensure there aren't any other open Pull Requests for the desired change?
Type of change
- [ β ] New feature (non-breaking change which adds functionality)
- [ β ] This change requires a documentation update
New Feature Submission:
- [ β ] Does your submission pass the tests?
- [ β ] Have you linted your code locally prior to submission?
Changes To Core Features:
- [ β ] Have you added an explanation of what your changes do and why you'd like us to include them?
- [ β ] Have you written new tests for your core changes, as applicable?
- [ β ] Have you successfully ran tests with your changes locally?
I'll work on that as well
This is currently how the styled upload works.
I thought that calling the super() class method would set the variable, is there any need to set the is_used variable again?
I thought that calling the super() class method would set the variable, is there any need to set the is_used variable again?
This will only set the is_used in StyledUpload, but the framework enable the upload features when Upload.is_used is true, so it need to be set.
Simply adding the line Upload.is_used = True inside the StyledUpload.create is enough to make it work.
I'm curious, I don't understand how the react component works as I haven't used React before, but If we decide to do super().is_used = True is that the same as Upload.is_used = True?
I'm curious, I don't understand how the react component works as I haven't used React before, but If we decide to do
super().is_used = Trueis that the same asUpload.is_used = True?
In that case it has nothing to do with React, it's purely a python situation, if you try super().is_used = True it will throw an error saying super doesn't have an is_used attribute.
Test with the following example :
class Foo:
is_used = False
@classmethod
def create(cls):
cls.is_used = True
return cls()
class Bar:
is_used = False
@classmethod
def create(cls):
cls.is_used = True
return super()
Bar.create()
print(Foo.is_used, Bar.is_used)