Skip to content
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

Merged
merged 6 commits into from
Jan 13, 2020

Conversation

marcin-witaszek-wttech
Copy link
Collaborator

No description provided.

@@ -56,3 +59,11 @@ export const renderCardContent = (
</StyledCardContent>
);
};

const AlwaysVisibleContent = ({ type, status, content, expanded }) => {
Copy link
Contributor

@michaldziubek michaldziubek Jan 10, 2020

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?

Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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' ? (
Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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 }) => {
Copy link
Collaborator

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.

Comment on lines 64 to 68
return type !== 'TextWidget' ? (
<WidgetTypeIcon type={type} status={status} content={content} />
) : expanded ? null : (
<TextWidget {...content} singleLine={true} />
);
Copy link
Collaborator

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.

Copy link
Collaborator Author

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
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@marcin-witaszek-wttech marcin-witaszek-wttech merged commit 58f479b into master Jan 13, 2020
@szymon-owczarzak szymon-owczarzak deleted the bugfix/text-expand-should-work-again branch January 17, 2020 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants