@@ -22,7 +22,9 @@ import type { WebsiteContent } from "api/v1"
2222import { LocalDate } from "ol-utilities"
2323import { useWebsiteContentList } from "api/hooks/website_content"
2424import { extractArticleContent } from "@/common/websiteContentUtils"
25- import { articleView } from "@/common/urls"
25+ import { articleView , websiteContentCreateView } from "@/common/urls"
26+ import { Permission , useUserHasPermission } from "api/hooks/user"
27+ import { ButtonLink } from "@mitodl/smoot-design"
2628
2729const PAGE_SIZE = 10
2830const MAX_PAGE = 50
@@ -223,6 +225,10 @@ const BannerGridContainer = styled.div`
223225 max-width: 842px;
224226 margin: 0 auto;
225227 padding: 64px 0;
228+ display: flex;
229+ flex-direction: row;
230+ justify-content: space-between;
231+ align-items: center;
226232
227233 ${ theme . breakpoints . down ( "sm" ) } {
228234 max-width: 100%;
@@ -299,6 +305,10 @@ const BannerSection = styled.div`
299305 background: ${ theme . custom . colors . white } ;
300306 border-bottom: 1px solid ${ theme . custom . colors . lightGray2 } ;
301307`
308+ const NewArticleLink = styled ( ButtonLink ) `
309+ display: flex;
310+ justify-content: end;
311+ `
302312
303313const EmptyState = styled . div `
304314 display: flex;
@@ -319,7 +329,6 @@ const EmptyState = styled.div`
319329
320330const BannerTitle = styled ( Typography ) `
321331 color: ${ theme . custom . colors . black } ;
322- margin-top: 8px;
323332 ${ theme . breakpoints . down ( "md" ) } {
324333 ${ { ...theme . typography . h2 } }
325334 }
@@ -329,16 +338,6 @@ const BannerTitle = styled(Typography)`
329338 }
330339` as typeof Typography
331340
332- const BannerDescription = styled ( Typography ) `
333- color: ${ theme . custom . colors . black } ;
334- margin-top: 16px;
335- font-size: 20px;
336- line-height: 32px;
337- ${ theme . breakpoints . down ( "sm" ) } {
338- ${ { ...theme . typography . body2 } }
339- }
340- `
341-
342341const BreadcrumbBar = styled . div ( ( { theme } ) => ( {
343342 width : "100%" ,
344343 padding : "18px 0 2px 0" ,
@@ -418,6 +417,8 @@ const ArticleListingPage: React.FC = () => {
418417 const parsedPage = Number . parseInt ( searchParams . get ( "page" ) ?? "1" , 10 )
419418 const page = Number . isFinite ( parsedPage ) && parsedPage > 0 ? parsedPage : 1
420419
420+ const isArticleEditor = useUserHasPermission ( Permission . ArticleEditor )
421+
421422 const { data : articles , isLoading } = useWebsiteContentList ( {
422423 limit : PAGE_SIZE ,
423424 offset : ( page - 1 ) * PAGE_SIZE ,
@@ -454,11 +455,16 @@ const ArticleListingPage: React.FC = () => {
454455 < BannerTitle component = "h1" variant = "h1" >
455456 Articles
456457 </ BannerTitle >
457- < BannerDescription variant = "body1" >
458- Dive into articles covering emerging technologies, global
459- challenges, and creative thinking. Stay connected with the latest
460- insights and discoveries from MIT.
461- </ BannerDescription >
458+ { isArticleEditor && (
459+ < NewArticleLink
460+ variant = "primary"
461+ href = { websiteContentCreateView ( "article" ) }
462+ >
463+ < Typography variant = "body1" color = "white" >
464+ New Article
465+ </ Typography >
466+ </ NewArticleLink >
467+ ) }
462468 </ BannerGridContainer >
463469 </ Container >
464470 </ BannerSection >
0 commit comments