-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Added support for external links in sections #921
Changes from 12 commits
d7838f9
1c9d38a
8231ef2
1855b1f
982fe46
67de765
09029e7
65a8e53
2fff2bd
4bea88e
18fdf4e
61cfc4e
34ee0b4
a946379
4d7031a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,9 @@ import SectionsRenderer from 'rsg-components/Sections/SectionsRenderer'; | |
export default function Sections({ sections, depth }) { | ||
return ( | ||
<SectionsRenderer> | ||
{sections.map((section, idx) => <Section key={idx} section={section} depth={depth} />)} | ||
{sections | ||
.filter(section => !section.href) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the use case for sections without href? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently any section added to the configuration will result in a section space being generated in the main content - this would also include the This will filter out those sections from being rendered in the main content area. |
||
.map((section, idx) => <Section key={idx} section={section} depth={depth} />)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think we can improve There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dont thinks so, unless we assume that all sections have unique hrefs, which they might now have, so I guess we are stuck with the index for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then title + href should be unique enough, I'd really like to avoid indexes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turns out that some sections do not have slug, but are rendered with an array of components - this is for example visible in sections example, WrappedButton link. |
||
</SectionsRenderer> | ||
); | ||
} | ||
|
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.
Not sure what's going on here; this looks to be changed by a pre-commit hook, and probably should?
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.
It looks like the file was edited in the browser so the precommit hook wasn't run ;-/ Could you please change
jsx
tomarkdown
for the whole block? It'll stop Prettier from adding;
.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 assume
jsx static
won't work here? Updating.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.
It's a bit confusing: here's an example of what you should write in Markdown, so the outer tag should be
markdown
instead ofjsx
.jsx noeditor
part is fine — it's part of an example.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.
Yes, I was thinking ````jsx static would work in order to keep highlights. Should be like you asked now; I think the newline was added by precommit hook again.
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.
New line is fine!