Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a quotation component and use it in files
Browse files Browse the repository at this point in the history
caulagi committed Sep 7, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
caulagi Pradip Caulagi
1 parent 2b57480 commit 23abf2c
Showing 5 changed files with 55 additions and 42 deletions.
9 changes: 4 additions & 5 deletions _posts/complementing-python-with-rust.mdx
Original file line number Diff line number Diff line change
@@ -24,11 +24,10 @@ Of the several features that Rust has, I find 3 are particularly relevant to bui

**Zero cost abstractions** is something Rust borrows from C++.

> C++ implementations obey the zero-overhead principle: What you don’t use, you don’t pay for. And further: What you do use, you couldn’t hand code any better
<div class="text-right text-sm text-indigo-400 font-semibold pt-2">
Stroustrup
</div>
<Quotation
author="Stroustrup"
quotation="C++ implementations obey the zero-overhead principle: What you don’t use, you don’t pay for. And further: What you do use, you couldn’t hand code any better"
/>

So this language principle would mean that, for features of the language that I don’t use, there should be no penalty. For features of the language that I do use, it shouldn’t be possible to do any better by going down in the stack (i.e. by writing generated machine instructions, for example). One obvious evidence of this is in the trait implementation. Traits is one of the cornerstone’s of the abstraction model in Rust. It allows us to add behaviour to types in a variety of cases. But the design principle and the implementation of this feature guarantees that there is no penalty/overhead for using Traits. See this [excellent post](https://blog.rust-lang.org/2015/05/11/traits.html) for details.

9 changes: 4 additions & 5 deletions _posts/first-look-at-golang.mdx
Original file line number Diff line number Diff line change
@@ -104,11 +104,10 @@ func serveFile(w ResponseWriter,

### Stdlib

> Talk small and carry a big class library
<div class="text-right text-sm text-indigo-400 font-semibold pt-2">
James Robertson, about Smalltalk.
</div>
<Quotation
author="James Robertson about Smalltalk"
quotation="Talk small and carry a big class library"
/>

Go is frequently said to be a modern language. This is evident in the standard libraries that come with the language. compress, crypt, html, etc are all libraries any program today would invariably use. In fact, you will notice that the static file server earlier is really tiny. It is due to the fact that stdlib has a complete implementation of a HTTP server with parts that can be easily customized.

26 changes: 10 additions & 16 deletions _posts/nodejs-vs-django.mdx
Original file line number Diff line number Diff line change
@@ -8,22 +8,16 @@ ogImage:
url: 'https://user-images.githubusercontent.com/222507/109427622-7ad93080-79f3-11eb-8411-519e3a696f6f.png'
---

<Card className="max-w-[400px]">
<CardHeader className="flex gap-3">
<div className="flex flex-col">
<p className="text-md">A mad tea party, Alice in Wonderland</p>
</div>
</CardHeader>
<Divider />
<CardBody>
<p>
The table was a large one, but the three were all crowded together at one
corner of it: 'No room! No room!' they cried out when they saw Alice
coming. 'There’s PLENTY of room!' said Alice indignantly, and she sat down
in a large arm-chair at one end of the table.
</p>
</CardBody>
</Card>
<Quotation
reference="A mad tea party, Alice in Wonderland"
author="Lewis Caroll"
quotation="
The table was a large one, but the three were all crowded together at one
corner of it: 'No room! No room!' they cried out when they saw Alice
coming. 'There’s PLENTY of room!' said Alice indignantly, and she sat down
in a large arm-chair at one end of the table.
"
/>

We have been using both Django and Nodejs at [WWStay](https://wwstay.com/).
We use Django for the customer dashboard and backoffice applications.
18 changes: 2 additions & 16 deletions components/post-body.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import { MDXRemote, MDXRemoteSerializeResult } from 'next-mdx-remote'
import {
Card,
CardHeader,
CardBody,
CardFooter,
Divider,
Link,
Image,
} from '@nextui-org/react'
import Quotation from './quotation'

type PostBodyProps = {
source: MDXRemoteSerializeResult
}

const components = {
Card,
CardBody,
CardHeader,
CardFooter,
Divider,
Link,
Image,
Quotation,
}

const PostBody: React.FC<PostBodyProps> = ({ source }) => {
35 changes: 35 additions & 0 deletions components/quotation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Card, CardBody, CardHeader, Divider } from '@nextui-org/react'

Check failure on line 1 in components/quotation.tsx

GitHub Actions / Build & test (20.x)

Type '{ children: Element; class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.

Check failure on line 1 in components/quotation.tsx

GitHub Actions / Build & test (20.x)

Type '{ children: ("" | Element | undefined)[]; class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.

Check failure on line 1 in components/quotation.tsx

GitHub Actions / Build & test (20.x)

Type '{ children: string; class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>'.

Check failure on line 1 in components/quotation.tsx

GitHub Actions / Build & test (20.x)

Type '{ class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLHRElement>, HTMLHRElement>'.

Check failure on line 1 in components/quotation.tsx

GitHub Actions / Build & test (20.x)

Type '{ children: string; class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.

Check failure on line 1 in components/quotation.tsx

GitHub Actions / Build & test (20.x)

Type '{ class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.

Check failure on line 1 in components/quotation.tsx

GitHub Actions / Build & test (20.x)

Type '{ children: string; class: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>'.

interface QuotationProps {
author: string
quotation: string
reference?: string
}

const Quotation: React.FC<QuotationProps> = ({
author,
quotation,
reference,
}) => {
return (
<div class="relative flex flex-col rounded-xl bg-white bg-clip-border text-gray-700 shadow-md">
<div class="p-6">
{reference && (
<div>
<h5 class="mb-2 block font-sans font-semibold leading-snug">
{reference}
</h5>
<hr class="border-gray-300 m-1 lg:m-1" />
</div>
)}
<div class="flex float-right">{author}</div>
<div class="clear-both"></div>
<p class="block font-sans text-base font-light leading-relaxed text-inherit antialiased">
{quotation}
</p>
</div>
</div>
)
}

export default Quotation

0 comments on commit 23abf2c

Please sign in to comment.