Skip to content

Commit

Permalink
feat: add font
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrad77 committed Dec 15, 2024
1 parent 2bac2ed commit 7a4b659
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 26 deletions.
5 changes: 2 additions & 3 deletions src/contents/Counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ function CounterRenderer({ content }: RendererProps<CounterContent>) {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
border: '1px solid black',
fontSize: '20px',
fontSize: content.fontSize,
}}
>
{content.paused ? 'Paused' : content.count}
{content.count}
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/contents/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function TextRenderer({ content }: RendererProps<TextContent>) {
color: content.color,
// textAlign: content.alignment as 'left' | 'center' | 'right',
}}
className="flex items-center justify-center border border-gray-300"
className="flex items-center justify-center"
>
{content.text}
</div>
Expand Down
32 changes: 17 additions & 15 deletions src/contents/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ export type Position = { top: string; left: string }; // Position coordinates fo
export type Size = { width: string; height: string }; // Size dimensions for content

// Content Types
export interface BaseContent {
id: string; // Unique identifier for the content
name?: string; // Name of the content
type: 'image' | 'video' | 'audio' | 'text' | 'counter'; // Type of content
show: boolean; // Visibility toggle
position: Position; // Content's position on screen
size: Size; // Dimensions of the content
layout?: any; // for positioning in the controller grid
interface BaseContent {
id: string;
name?: string;
type: 'image' | 'video' | 'audio' | 'text' | 'counter';
show: boolean;
position: Position;
size: Size;
layout?: any;
}

export interface ImageContent extends BaseContent {
Expand All @@ -28,22 +28,24 @@ export interface VideoContent extends BaseContent {

export interface AudioContent extends BaseContent {
type: 'audio';
file: string; // Base64-encoded audio file
autoplay?: boolean; // Autoplay toggle
loop?: boolean; // Loop playback toggle
volume: number; // Volume level (0 to 100)
file: string;
autoplay?: boolean;
loop?: boolean;
volume: number;
}

export interface TextContent extends BaseContent {
type: 'text';
text: string; // The text string to display
fontSize: string; // Font size (e.g., "16px")
color: string; // Font color (e.g., "#000000")
text: string;
fontSize: string;
color: string;
}

export interface CounterContent extends BaseContent {
type: 'counter';
count: number;
fontSize: string;
color: string;
paused: boolean;
}

Expand Down
7 changes: 7 additions & 0 deletions src/renderer/App.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@font-face {
font-family: 'Mahmood';
src: url('./Mahmood-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
2 changes: 0 additions & 2 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { HashRouter as Router, Routes, Route } from 'react-router-dom';
import './App.css';
import 'react-grid-layout/css/styles.css';
import 'react-resizable/css/styles.css';
import { ControllerPanel } from './pages/ControllerPanel';
import { ProjectorPanel } from './pages/ProjectorPanel';

Expand Down
Binary file added src/renderer/Mahmood-Regular.ttf
Binary file not shown.
4 changes: 4 additions & 0 deletions src/renderer/pages/Controller.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
body {
@apply font-sans;
}

.ctrl-main {
display: flex;
flex-direction: row;
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/pages/ControllerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
import { getFileBlob, revokeBlobUrl } from '../../fileUtils';
import { ContentControllerFactory } from '../../contents/ContentControllerFactory';
import type { Content } from '../../contents/types';
import 'react-grid-layout/css/styles.css';
import 'react-resizable/css/styles.css';
import './Controller.css';

const getDefaultHeight = (type: string) => {
Expand Down Expand Up @@ -122,7 +124,7 @@ export const ControllerPanel: React.FC = () => {
};

return (
<div className="h-screen w-screen flex flex-col">
<div className="h-screen w-screen flex flex-col font-sans">
{/* Top Bar */}
<div className="flex justify-between items-center px-4 py-2 bg-gray-800">
<div className="flex space-x-2">
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/pages/Projector.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* Projector.css
*/
body {
@apply font-mahmood;
position: relative;
background-color: #000;
color: white;
height: 100vh;
font-family: sans-serif;
overflow-y: hidden;
display: flex;
justify-content: center;
Expand All @@ -33,15 +33,14 @@ body {
display: none;
}


.proj-counter-wrapper {
/* Positioned absolutely based on inline styles */
padding: 10px;
background-color: rgba(255, 255, 255, 0.8);
z-index: 10;
margin: 10px;
padding: 2rem;
background-color: #FFF;
background-color: #fff;
text-align: center;
}

Expand Down
6 changes: 5 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
module.exports = {
content: ['./src/**/*.{html,ts,tsx,js,jsx}'],
theme: {
extend: {},
extend: {
fontFamily: {
mahmood: ['Mahmood', 'sans-serif'],
},
},
},
plugins: [],
};

0 comments on commit 7a4b659

Please sign in to comment.