Skip to content

Commit 9d668f6

Browse files
Adding font size changes to mobile apps (#563)
1 parent 4e3f197 commit 9d668f6

9 files changed

Lines changed: 435 additions & 170 deletions

File tree

application/core/resources/src/commonMain/composeResources/values-pt/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<string name="add_note">Adicionar nota</string>
1919
<string name="back">Voltar</string>
2020
<string name="copy_note">Copiar documento</string>
21-
<string name="favorite">Favotiro</string>
21+
<string name="favorite">Favorito</string>
2222
<string name="delete">Deletar</string>
2323
<string name="logout">Sair</string>
2424
<string name="export_json">Exportar como JSON</string>

application/features/editor/src/androidMain/kotlin/io/writeopia/editor/features/editor/ui/screen/NoteEditorScreen.android.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ import io.writeopia.editor.input.InputScreen
6464
import io.writeopia.editor.model.EditState
6565
import io.writeopia.sdk.models.id.GenerateId
6666
import io.writeopia.sdk.models.span.Span
67+
import io.writeopia.sdk.models.story.Tag
68+
import io.writeopia.theme.WriteopiaTheme
6769
import io.writeopia.ui.components.EditionScreen
6870
import io.writeopia.ui.drawer.factory.DefaultDrawersAndroid
6971
import io.writeopia.ui.model.SelectionMetadata
@@ -161,7 +163,8 @@ internal fun NoteEditorScreen(
161163
noteEditorViewModel::onAddCheckListClick,
162164
noteEditorViewModel::onAddListItemClick,
163165
noteEditorViewModel::addPage,
164-
noteEditorViewModel::toggleHighLightBlock
166+
noteEditorViewModel::toggleHighLightBlock,
167+
noteEditorViewModel::titleClick
165168
)
166169
}
167170

@@ -323,6 +326,7 @@ private fun BottomScreen(
323326
onListItem: () -> Unit = {},
324327
onAddPage: () -> Unit = {},
325328
onHighlight: () -> Unit,
329+
titleClick: (Tag) -> Unit
326330
) {
327331
val edit by editState.collectAsState()
328332

@@ -362,6 +366,8 @@ private fun BottomScreen(
362366
EditState.SELECTED_TEXT -> {
363367
EditionScreen(
364368
modifier = containerModifier,
369+
metadataState = metadataState,
370+
highlightButtonColor = WriteopiaTheme.colorScheme.optionsSelector,
365371
onSpanClick = onSpanSelected,
366372
onDelete = deleteSelection,
367373
onCopy = copySelection,
@@ -370,7 +376,8 @@ private fun BottomScreen(
370376
checkboxClick = onCheckItem,
371377
listItemClick = onListItem,
372378
onHighlight = onHighlight,
373-
onAddPage = onAddPage
379+
onAddPage = onAddPage,
380+
titleClick = titleClick
374381
)
375382
}
376383
}

application/features/editor/src/commonMain/kotlin/io/writeopia/editor/features/editor/ui/desktop/edit/menu/SideEditorOptions.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ import io.writeopia.ui.model.SelectionMetadata
6767
import kotlinx.coroutines.flow.Flow
6868
import kotlinx.coroutines.flow.StateFlow
6969

70+
private const val MENU_WIDTH = 300
71+
7072
@Composable
7173
fun SideEditorOptions(
7274
modifier: Modifier = Modifier,
@@ -335,7 +337,7 @@ private fun PageOptions(
335337
MaterialTheme.colorScheme.surfaceVariant,
336338
MaterialTheme.shapes.medium
337339
).background(MaterialTheme.colorScheme.background, MaterialTheme.shapes.medium)
338-
.width(250.dp)
340+
.width(MENU_WIDTH.dp)
339341
.padding(start = 12.dp, end = 12.dp, top = 8.dp, bottom = 12.dp)
340342
) {
341343
Title("Font")
@@ -379,7 +381,7 @@ private fun Title(text: String) {
379381
}
380382

381383
@Composable
382-
private fun TitleChanges(
384+
fun TitleChanges(
383385
metadata: Set<SelectionMetadata>,
384386
modifier: Modifier = Modifier,
385387
titleClick: (Tag) -> Unit
@@ -795,7 +797,7 @@ private fun TextOptions(
795797
MaterialTheme.colorScheme.surfaceVariant,
796798
MaterialTheme.shapes.medium
797799
).background(MaterialTheme.colorScheme.background, MaterialTheme.shapes.medium)
798-
.width(250.dp)
800+
.width(MENU_WIDTH.dp)
799801
.padding(start = 12.dp, end = 12.dp, top = 8.dp, bottom = 12.dp)
800802
) {
801803
val selectedMetadata by selectedMetadataState.collectAsState()
@@ -863,7 +865,7 @@ private fun Actions(
863865
MaterialTheme.colorScheme.surfaceVariant,
864866
MaterialTheme.shapes.medium
865867
).background(MaterialTheme.colorScheme.background, MaterialTheme.shapes.medium)
866-
.width(250.dp)
868+
.width(MENU_WIDTH.dp)
867869
.padding(start = 12.dp, end = 12.dp, top = 8.dp, bottom = 12.dp)
868870
) {
869871
Title(WrStrings.export())
@@ -912,7 +914,7 @@ private fun AiOptions(
912914
MaterialTheme.colorScheme.surfaceVariant,
913915
MaterialTheme.shapes.medium
914916
).background(MaterialTheme.colorScheme.background, MaterialTheme.shapes.medium)
915-
.width(250.dp)
917+
.width(MENU_WIDTH.dp)
916918
.padding(start = 12.dp, end = 12.dp, top = 8.dp, bottom = 12.dp)
917919
) {
918920
Title(WrStrings.askAi())

application/features/editor/src/nativeMain/kotlin/io/writeopia/editor/features/editor/ui/screen/NoteEditorScreen.native.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ import io.writeopia.editor.input.InputScreen
5555
import io.writeopia.editor.model.EditState
5656
import io.writeopia.sdk.models.id.GenerateId
5757
import io.writeopia.sdk.models.span.Span
58+
import io.writeopia.sdk.models.story.Tag
59+
import io.writeopia.theme.WriteopiaTheme
5860
import io.writeopia.ui.components.EditionScreen
5961
import io.writeopia.ui.drawer.factory.DefaultDrawersNative
6062
import io.writeopia.ui.model.SelectionMetadata
@@ -134,7 +136,8 @@ internal fun NoteEditorScreen(
134136
noteEditorViewModel::onAddCheckListClick,
135137
noteEditorViewModel::onAddListItemClick,
136138
noteEditorViewModel::addPage,
137-
noteEditorViewModel::toggleHighLightBlock
139+
noteEditorViewModel::toggleHighLightBlock,
140+
noteEditorViewModel::titleClick
138141
)
139142
}
140143

@@ -279,6 +282,7 @@ private fun BottomScreen(
279282
onListItem: () -> Unit = {},
280283
onAddPage: () -> Unit = {},
281284
onHighlight: () -> Unit = {},
285+
titleClick: (Tag) -> Unit
282286
) {
283287
val edit by editState.collectAsState()
284288

@@ -318,6 +322,8 @@ private fun BottomScreen(
318322
EditState.SELECTED_TEXT -> {
319323
EditionScreen(
320324
modifier = containerModifier,
325+
metadataState = metadataState,
326+
highlightButtonColor = WriteopiaTheme.colorScheme.optionsSelector,
321327
onSpanClick = onSpanSelected,
322328
onHighlight = onHighlight,
323329
onDelete = deleteSelection,
@@ -327,6 +333,7 @@ private fun BottomScreen(
327333
checkboxClick = onCheckItem,
328334
listItemClick = onListItem,
329335
onAddPage = onAddPage,
336+
titleClick = titleClick
330337
)
331338
}
332339
}

writeopia_ui/config/ktlint/baseline.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@
338338
<error line="84" column="13" source="standard:backing-property-naming" />
339339
<error line="84" column="13" source="standard:backing-property-naming" />
340340
</file>
341+
<file name="src/commonMain/kotlin/io/writeopia/ui/icons/all/LargeSmallA.kt">
342+
<error line="67" column="13" source="standard:backing-property-naming" />
343+
</file>
341344
<file name="src/commonMain/kotlin/io/writeopia/ui/icons/all/List.kt">
342345
<error line="115" column="13" source="standard:backing-property-naming" />
343346
<error line="115" column="13" source="standard:backing-property-naming" />

0 commit comments

Comments
 (0)