-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restored Text widget expand functionality with display fixes #206
Restored Text widget expand functionality with display fixes #206
Conversation
@@ -56,3 +59,11 @@ export const renderCardContent = ( | |||
</StyledCardContent> | |||
); | |||
}; | |||
|
|||
const AlwaysVisibleContent = ({ type, status, content, expanded }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if AlwaysVisibleContent is the most fortunate name regarding the fact it can return null. Maybe sth like ExpandableContent or ComponentSpecificAdditionalContent/AdditionalContent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the name as well :) What about the PrimaryContent? Anyway this logic for displaying content starting to cause me headache... Maybe we should think about serious restructure? We should think about all the content we have in the widget and decide which should be managed on the widget level and on the widget content level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I choose ExpandableContent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's catch up after conference to discuss the approach. I agree that it needs some abstraction refactor.
@@ -56,3 +59,11 @@ export const renderCardContent = ( | |||
</StyledCardContent> | |||
); | |||
}; | |||
|
|||
const ExpandableContent = ({ type, status, content, expanded }) => { | |||
return type !== 'TextWidget' ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure about this complex ternary, it is extremely hard to read. How about simplifying this? Could be in some separate ticket if there is no time for that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will refactor it in a moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -56,3 +59,11 @@ export const renderCardContent = ( | |||
</StyledCardContent> | |||
); | |||
}; | |||
|
|||
const AlwaysVisibleContent = ({ type, status, content, expanded }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the name as well :) What about the PrimaryContent? Anyway this logic for displaying content starting to cause me headache... Maybe we should think about serious restructure? We should think about all the content we have in the widget and decide which should be managed on the widget level and on the widget content level.
return type !== 'TextWidget' ? ( | ||
<WidgetTypeIcon type={type} status={status} content={content} /> | ||
) : expanded ? null : ( | ||
<TextWidget {...content} singleLine={true} /> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to avoid such complicated ternary logic. It would be much nicer with ifs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, done
@@ -54,7 +64,8 @@ const TextWidget = ({ text, textSize, isVertical }) => { | |||
TextWidget.propTypes = { | |||
text: string.isRequired, | |||
textSize: string.isRequired, | |||
isVertical: bool.isRequired | |||
isVertical: bool.isRequired, | |||
singleLine: bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide default for non required prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
No description provided.