make landing page in typescript

To make a landing page in Typescript, you can leverage libraries like React and use HTML and CSS to build up the components. Additionally, you may need to utilize some Javascript to handle events and interactions.

Here's a basic example of how you can create a simple landing page in Typescript using React:

First, you need to create a new React component by creating a new file called LandingPage.tsx:

index.ts
import React from 'react';

const LandingPage: React.FC = () => {
  return (
    <div className="landing-page">
      <h1>Welcome to my Landing Page!</h1>
      <p>Thanks for visiting!</p>
    </div>
  );
};

export default LandingPage;
237 chars
13 lines

You can then create a root index.tsx file to render the LandingPage component:

index.ts
import React from 'react';
import ReactDOM from 'react-dom';
import LandingPage from './LandingPage';

ReactDOM.render(<LandingPage />, document.getElementById('root'));
170 chars
6 lines

To style the landing page, you can create a separate CSS file and import that into your LandingPage.tsx file:

.landing-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background-color: #f2f2f2;
}

h1 {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 32px;
}

p {
  font-size: 24px;
}
254 chars
19 lines

Finally, you can create an HTML file with a div element that has an id of "root" to render the React component:

<html>
  <head>
    <title>My Landing Page</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <div id="root"></div>
    <script src="index.js"></script>
  </body>
</html>
199 chars
11 lines

Once you have all of the above files set up, you can run your app by compiling your Typescript code to JavaScript and then opening the HTML file in a browser.

gistlibby LogSnag