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

[Ticket ID or name] Change button background to red #393

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions app/components/Article/KeepGoing/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Button from '~/components/Button'
import ListTable from '~/components/Table'
import {ArrowRight} from '~/components/icons-generated'
import useToC from '~/hooks/useToC'
import type {TOCItem} from '~/routes/questions.toc'
import type {Question} from '~/server-utils/stampy'
import './keepGoing.css'

const NextArticle = ({category, next}: {category?: string; next?: TOCItem}) =>
next && (
<>
<h2>Keep going! &#128073;</h2>
<span>Continue with the next article in {category}</span>
<div className="keepGoing-next">
<span className="keepGoing-next-title">{next.title}</span>
<Button action={`/${next.pageid}`} className="primary-alt">
Next
<ArrowRight />
</Button>
</div>
</>
)

export const KeepGoing = ({pageid, relatedQuestions}: Question) => {
const {findSection, getNext} = useToC()
const {category} = findSection(pageid) || {}
const next = getNext(pageid)
const hasRelated = relatedQuestions && relatedQuestions.length > 0

return (
<div className="keepGoing">
<NextArticle category={category} next={next} />

{next && hasRelated && <span>Or jump to a related question</span>}
{hasRelated && <ListTable elements={relatedQuestions.map((i) => ({...i, hasIcon: true}))} />}
</div>
)
}

export default KeepGoing
5 changes: 4 additions & 1 deletion app/components/Article/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {useRef, useState, useEffect} from 'react'
import KeepGoing from '~/components/Article/KeepGoing'
import CopyIcon from '~/components/icons-generated/Copy'
import EditIcon from '~/components/icons-generated/Pencil'
import ThumbUpIcon from '~/components/icons-generated/ThumbUp'
Expand Down Expand Up @@ -232,7 +233,7 @@ export const Article = ({question, glossary}: ArticleProps) => {
const time = text.split(' ')
return Math.ceil(time.length / rate) // ceil to avoid "0 min read"
}
console.log('Question', question)

return (
<article className="article-container">
<h1 className="teal">{title}</h1>
Expand All @@ -244,6 +245,8 @@ export const Article = ({question, glossary}: ArticleProps) => {

<Contents pageid={pageid} html={text || ''} glossary={glossary || {}} />

<KeepGoing {...question} />

<ArticleFooter {...question} />
<hr />
<div className="article-tags">
Expand Down
47 changes: 0 additions & 47 deletions app/components/ArticleKeepGoing/index.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion app/components/Button/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
}

.primary {
background: var(--colors-teal-500, #1d9089);
/* background: var(--colors-teal-500, #1d9089); */
background: red;
melissasamworth marked this conversation as resolved.
Show resolved Hide resolved
font-weight: 600;
color: var(--colors-white, #ffffff);
}
Expand Down
7 changes: 6 additions & 1 deletion app/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ import {Link} from '@remix-run/react'
import {ArrowUpRight} from '~/components/icons-generated'
import './listTable.css'

export type ListItem = {
pageid: string
title: string
hasIcon?: boolean
}
export type ListTableProps = {
/**
* Browse by category
*/
elements: any[]
elements: ListItem[]
}

export const ListTable = ({elements}: ListTableProps) => (
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Aisafety.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgAisafety = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 175 40" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/ArrowRight.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgArrowRight = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={16} height={16} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/ArrowUpRight.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgArrowUpRight = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={16} height={16} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/BottomEclipse.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgBottomEclipse = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={320} height={289} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Chatbot.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgChatbot = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Code.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgCode = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 640 640" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Copy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgCopy = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/DarkLight.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgDarkLight = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 512 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Discord.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgDiscord = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Dislike.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgDislike = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/EclipseBook.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgEclipseBook = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={1056} height={348} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/EclipseIndividual.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgEclipseIndividual = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={320} height={224} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/EclipseTeam.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgEclipseTeam = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 320 289" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Edit.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgEdit = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 512 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Ellipsis.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgEllipsis = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 448 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Flag.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgFlag = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Followup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgFollowup = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 512 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/GroupTopEcplise.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgGroupTopEcplise = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={320} height={224} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Hide.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgHide = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 640 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Like.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgLike = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 512 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgLink = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Magnifying.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgMagnifying = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 17" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/MagnifyingGlass.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgMagnifyingGlass = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 512 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/OpenBook.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgOpenBook = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Paper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgPaper = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Pencil.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgPencil = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/PlaneSend.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgPlaneSend = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={48} height={48} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgSearch = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 512 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Share.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgShare = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve" viewBox="0 0 448 512" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Speaker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgSpeaker = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/StampyChat.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgStampyChat = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={40} height={35} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Tag.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgTag = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/ThumbDown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgThumbDown = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={16} height={16} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/ThumbUp.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgThumbUp = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" width={16} height={16} fill="none" {...props}>
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Undo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgUndo = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/Users.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgUsers = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
1 change: 0 additions & 1 deletion app/components/icons-generated/X.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import type {SVGProps} from 'react'
const SvgX = (props: SVGProps<SVGSVGElement>) => (
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 16" {...props}>
Expand Down
4 changes: 2 additions & 2 deletions app/hooks/stateModifiers.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Question, QuestionState, RelatedQuestions, PageId} from '~/server-utils/stampy'
import {Question, QuestionState, RelatedQuestion, PageId} from '~/server-utils/stampy'

type StateEntry = [PageId, QuestionState]
type StateString = string
Expand Down Expand Up @@ -70,7 +70,7 @@ export const insertAfter = (state: StateString, pageId: PageId, to: PageId): Sta
export const insertInto = (
state: StateString,
pageid: PageId,
relatedQuestions: RelatedQuestions,
relatedQuestions: RelatedQuestion[],
options = {toggle: true}
): StateString =>
processStateEntries(state, (entries: StateEntry[]) =>
Expand Down
3 changes: 1 addition & 2 deletions app/hooks/useCachedObjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type useCachedObjectsType = {
tags: useObjectsType<Tag[]>
toc: useObjectsType<TOCItem[]>
}
const CachedObjectsContext = createContext<useCachedObjectsType | null>(null)
export const CachedObjectsContext = createContext<useCachedObjectsType | null>(null)

const getGlossary = async () => (await fetchGlossary()).data
const getTags = async () => (await fetchTags()).tags
Expand All @@ -40,7 +40,6 @@ export const CachedObjectsProvider = ({children}: {children: ReactElement}) => {
const tags = useItemsFuncs<Tag[]>(getTags)
const toc = useItemsFuncs<TOCItem[]>(getToC)

console.log('caching')
return (
<CachedObjectsContext.Provider value={{tags, glossary, toc}}>
{children}
Expand Down
4 changes: 2 additions & 2 deletions app/hooks/useQuestionStateInUrl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useState, useRef, useEffect, useMemo, useCallback} from 'react'
import {useSearchParams, useNavigation} from '@remix-run/react'
import {Question, QuestionState, RelatedQuestions, PageId, Glossary} from '~/server-utils/stampy'
import {Question, QuestionState, RelatedQuestion, PageId, Glossary} from '~/server-utils/stampy'
import {fetchAllQuestionsOnSite} from '~/routes/questions.allQuestionsOnSite'
import {fetchGlossary} from '~/routes/questions.glossary'
import {
Expand Down Expand Up @@ -136,7 +136,7 @@ export default function useQuestionStateInUrl(minLogo: boolean, initialQuestions
const unshownRelatedQuestions = (
questions: Question[],
questionProps: Question
): RelatedQuestions => {
): RelatedQuestion[] => {
const {relatedQuestions} = questionProps

const onSiteQuestions = onSiteQuestionsRef.current
Expand Down
Loading
Loading