Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Adiciona página junte-se com renderização de arquivo MarkDown #86

Merged
merged 5 commits into from
Oct 5, 2019
Merged

Adiciona página junte-se com renderização de arquivo MarkDown #86

merged 5 commits into from
Oct 5, 2019

Conversation

lucasmedeiros
Copy link
Contributor

Fixes #80

Qual o propósito dessa pull request?

Esta PR adiciona uma nova página Junte-se a nós, que contém informações detalhadas de como ter um projeto opensource apoiado pela OpenDevUFCG.

O que foi feito?

Implementei uma nova rota /junte-se, e utilizei o react-markdown para a criação de um componente que serve para a renderização de arquivos MarkDown dentro de um outro componente React, conforme sugerido por @thayannevls. Todas as informações foram adicionadas num arquivo JoinUs.md, que por sua vez, foi renderizado a partir do componente renderizador.

Tipo de mudanças

  • Bug fix (non-breaking change which fixes an issue)
  • Nova feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires change to documentation, which has been updated accordingly.

@fanny fanny self-requested a review October 5, 2019 18:07
useEffect(() => {
async function fetchFileAndSetState() {
const response = await fetch(joinUsFile);
const text = await response.text();
Copy link
Contributor

Choose a reason for hiding this comment

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

this await is really necessary? because, in my understanding response will have a value when arrive at this line

Suggested change
const text = await response.text();
const text = response.text();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fetch returns a Response object, and its body is a Readable Stream. In the same way we need to use json async method when we want this response's body as a JSON, in this case it's necessary to get the body as a text, so I decided to use text method.

import joinUsFile from './JoinUs.md';

const JoinUsPage = () => {
const [markDownText, setMarkDownText] = useState('');
Copy link
Contributor

@fanny fanny Oct 5, 2019

Choose a reason for hiding this comment

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

Why you put in a state? The markdown is static, so we don't need a state here, imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By using a state, the page will render while the MarkDown text is being obtained by fetch, and also I can pass its value as props for MarkDownRenderer component.

src/components/joinus/JoinUs.md Outdated Show resolved Hide resolved
src/components/joinus/JoinUs.md Outdated Show resolved Hide resolved
@lucasmedeiros
Copy link
Contributor Author

lucasmedeiros commented Oct 5, 2019

@fanny I updated the description of how to add a repository to IssueAi with the future link of when your PR is merged. Because of this, it's temporarily broken.

@lucasmedeiros lucasmedeiros requested a review from fanny October 5, 2019 21:04
@fanny fanny merged commit 826f8ac into OpenDevUFCG:master Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fazer página para 'Junte-se a nós'
2 participants